Пример #1
0
    static int set_table(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaFramework.GameLuaComponent obj = (LuaFramework.GameLuaComponent)o;
            LuaTable arg0 = ToLua.CheckLuaTable(L, 2);
            obj.table = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index table on a nil value" : e.Message));
        }
    }
Пример #2
0
    static int get_table(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LuaFramework.GameLuaComponent obj = (LuaFramework.GameLuaComponent)o;
            LuaInterface.LuaTable         ret = obj.table;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index table on a nil value" : e.Message));
        }
    }
        public static LuaTable Add(GameObject go, LuaTable tableClass)
        {
            LuaFunction fun = tableClass.GetLuaFunction("New");

            if (fun == null)
            {
                return(null);
            }

            object[] rets = fun.Call(tableClass);
            if (rets.Length != 1)
            {
                return(null);
            }

            GameLuaComponent cmp = go.AddComponent <GameLuaComponent>();

            cmp.table = (LuaTable)rets[0];
            print("???");
            cmp.CallAwake();
            return(cmp.table);
        }