示例#1
0
        public static int msgHandler(IntPtr L)
        {
            if (!LuaDLL.lua_isstring(L, 1))
            {
                return(1);
            }
            LuaDLL.wlua_getglobal(L, "debug");            //msg,debug
            if (!LuaDLL.lua_istable(L, -1))
            {
                LuaDLL.lua_pop(L, 1);
                return(1);
            }
            LuaDLL.wlua_getfield(L, -1, "traceback");             //msg,debug,traceback
            if (!LuaDLL.lua_isfunction(L, -1))
            {
                LuaDLL.lua_pop(L, 2);
                return(1);
            }
            LuaStateCache cache = LuaStateCacheMan.GetLuaStateCache(L);

            LuaDLL.lua_pushvalue(L, 1);                                   //msg,debug,traceback,msg
            LuaDLL.lua_pushinteger(L, 2 + (cache.isException() ? 2 : 0)); //msg,debug,traceback,msg,level
            LuaDLL.lua_pcall(L, 2, 1, 0);                                 //msg,debug,tracebackstring
            cache.clearException();
            return(1);
        }
示例#2
0
        public static System.Object GetObject(IntPtr L, int index)
        {
            LuaTypes type = (LuaTypes)LuaDLL.lua_type(L, index);

            if (type != LuaTypes.LUA_TUSERDATA)
            {
                return(null);
            }
            IntPtr        idptr = LuaDLL.lua_touserdata(L, index);
            LuaStateCache cache = LuaStateCacheMan.GetLuaStateCache(L);

            return(cache.GetObject(idptr));
        }
示例#3
0
        void DisposeException(IntPtr L)
        {
            LuaStateCache cache = LuaStateCacheMan.GetLuaStateCache(L);

            cache.setException();
        }
示例#4
0
        public static void RemoveObject(IntPtr L, IntPtr userdata)
        {
            LuaStateCache cache = LuaStateCacheMan.GetLuaStateCache(L);

            cache.RemoveObject(userdata);
        }
示例#5
0
        //L:  [namespace Table]
        public static bool AddObject2Lua(IntPtr L, System.Object obj, string metatable /*nullable*/)
        {
            LuaStateCache cache = LuaStateCacheMan.GetLuaStateCache(L);

            return(cache.AddObject(L, obj, metatable));
        }