예제 #1
0
        public static void DoString(IntPtr L, string script)
        {
            LuaHook.isHook = false;
            byte[] chunk  = Encoding.UTF8.GetBytes(script);
            int    oldTop = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "miku_handle_error");
            if (LuaDLL.luaL_loadbuffer(L, chunk, (IntPtr)chunk.Length, "chunk") == 0)
            {
                if (LuaDLL.lua_pcall(L, 0, -1, oldTop + 1) == 0)
                {
                    LuaDLL.lua_remove(L, oldTop + 1);
                }
            }
            else
            {
                Debug.Log(script);
            }
            LuaHook.isHook = true;
            LuaDLL.lua_settop(L, oldTop);
        }
예제 #2
0
 public static int luaL_loadbuffer_replace(IntPtr luaState, byte[] buff, int size, string name)
 {
     buff = LuaHook.Hookloadbuffer(luaState, buff, name);
     return(LuaDLL.luaL_loadbuffer(luaState, buff, (IntPtr)(buff.Length), name));
 }