コード例 #1
0
        static void completeTypeMeta(IntPtr l, LuaCSFunction con, Type self)
        {
            LuaDLL.lua_pushstring(l, ObjectCache.getAQName(self));
            LuaDLL.lua_setfield(l, -3, "__fullname");

            LuaDLL.lua_pushstring(l, "__fullname");
            LuaDLL.lua_pushstring(l, self.FullName);
            LuaDLL.lua_rawset(l, -3);

            LuaDLL.lua_pushstring(l, "__typename");
            LuaDLL.lua_pushstring(l, self.Name);
            LuaDLL.lua_rawset(l, -3);

            index_func.push(l);
            LuaDLL.lua_setfield(l, -2, "__index");

            newindex_func.push(l);
            LuaDLL.lua_setfield(l, -2, "__newindex");

            if (con == null)
            {
                con = noConstructor;
            }

            pushValue(l, con);
            LuaDLL.lua_setfield(l, -2, "__call");

            LuaDLL.lua_pushcfunction(l, typeToString);
            LuaDLL.lua_setfield(l, -2, "__tostring");

            LuaDLL.lua_pushvalue(l, -1);
            LuaDLL.lua_setmetatable(l, -3);

            LuaDLL.lua_setfield(l, LuaIndexes.LUA_REGISTRYINDEX, self.FullName);
        }
コード例 #2
0
ファイル: Helper.cs プロジェクト: rhy2020/LuaGame
        static public void reg(IntPtr l)
        {
            getTypeTable(l, "LuaHelper");
            addMember(l, CreateAction, false);
            addMember(l, CreateClass, false);
            addMember(l, GetClass, false);
            addMember(l, iter, false);
            addMember(l, ToString, false);
            addMember(l, As, false);
            addMember(l, IsNull, false);
            addMember(l, MakeArray, false);
            addMember(l, ToBytes, false);
            addMember(l, "out", get_out, null, false);
            addMember(l, "version", get_version, null, false);
            addMember(l, GetClsType, false);
            addMember(l, StringToBytes, false);
            addMember(l, BytesToString, false);
            addMember(l, BytesArrayToTable, false);
            addMember(l, LuaStringToBytes, false);
            addMember(l, BytesToLuaString, false);

            LuaFunction func = LuaState.get(l).doString(classfunc) as LuaFunction;

            func.push(l);
            LuaDLL.lua_setfield(l, -3, "Class");


            createTypeMetatable(l, null, typeof(LuaHelper));
        }
コード例 #3
0
        static public void reg(IntPtr l)
        {
            getTypeTable(l, "Slua");
            addMember(l, CreateAction, false);
            addMember(l, CreateClass, false);
            addMember(l, GetClass, false);
            addMember(l, iter, false);
            addMember(l, ToString, false);
            addMember(l, As, false);
            addMember(l, IsNull, false);
            addMember(l, MakeArray, false);
            addMember(l, ToBytes, false);
            addMember(l, UserdataToLuaTab, false);
            addMember(l, "out", get_out, null, false);
            addMember(l, "version", get_version, null, false);
            addMember(l, CheckString, false);

            var         classfunc = LuaInnerStrings.classfunc;
            LuaFunction func      = LuaState.get(l).doString(classfunc) as LuaFunction;

            func.push(l);
            LuaDLL.lua_setfield(l, -3, "Class");

            createTypeMetatable(l, null, typeof(Helper));
        }
コード例 #4
0
ファイル: LuaThreadWrapper.cs プロジェクト: gh201200/Game
 public LuaThreadWrapper(LuaFunction func)
     : base()
 {
     Logger.Log(string.Format("LuaThreadWrapper.ctor/1: {0}", LuaDLL.lua_gettop(func.L)));
     state    = LuaState.get(func.L);
     _thread  = LuaDLL.lua_newthread(func.L);
     valueref = LuaDLL.luaL_ref(func.L, LuaIndexes.LUA_REGISTRYINDEX);
     func.push(func.L);
     LuaDLL.lua_xmove(func.L, _thread, 1);
     Logger.Log(string.Format("LuaThreadWrapper.ctor/2: {0}", LuaDLL.lua_gettop(func.L)));
 }
コード例 #5
0
 public LuaThreadWrapper(LuaFunction func)
     : base()
 {
     Debug.LogFormat("LuaThreadWrapper.ctor/1: {0}", LuaDLL.lua_gettop(func.L));
     state    = LuaState.get(func.L); // why do not give access of state?
     _thread  = LuaDLL.lua_newthread(func.L);
     valueref = LuaDLL.luaL_ref(func.L, LuaIndexes.LUA_REGISTRYINDEX);
     func.push(func.L);
     LuaDLL.lua_xmove(func.L, _thread, 1);
     Debug.LogFormat("LuaThreadWrapper.ctor/2: {0}", LuaDLL.lua_gettop(func.L));
 }
コード例 #6
0
 // Token: 0x060001B5 RID: 437 RVA: 0x0000930C File Offset: 0x0000750C
 public LuaThreadWrapper(LuaFunction func)
 {
     UnityEngine.Debug.LogFormat("LuaThreadWrapper.ctor/1: {0}", new object[]
     {
         LuaDLL.lua_gettop(func.L)
     });
     this.state    = LuaState.get(func.L);
     this._thread  = LuaDLL.lua_newthread(func.L);
     this.valueref = LuaDLL.luaL_ref(func.L, LuaIndexes.LUA_REGISTRYINDEX);
     func.push(func.L);
     LuaDLL.lua_xmove(func.L, this._thread, 1);
     UnityEngine.Debug.LogFormat("LuaThreadWrapper.ctor/2: {0}", new object[]
     {
         LuaDLL.lua_gettop(func.L)
     });
 }