public static void DoString(IntPtr L, string script) { LuaDLL.isHook = false; byte[] chunk = Encoding.UTF8.GetBytes(script); int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "miku_handle_error"); if (LuaDLL.luaL_loadbufferUnHook(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); } LuaDLL.isHook = true; LuaDLL.lua_settop(L, oldTop); }
public static void DoString(IntPtr L, string script) { byte[] chunk = Encoding.UTF8.GetBytes(script); int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "miku_handle_error"); MessageBox.Show("dostring"); if (LuaDLL.luaL_loadbufferUnHook(L, chunk, (IntPtr)chunk.Length, "chunk") == 0) { if (LuaDLL.lua_pcall(L, 0, -1, oldTop + 1) == 0) { LuaDLL.lua_remove(L, oldTop + 1); } } else { MessageBox.Show("error:" + script); } MessageBox.Show("dostring end"); LuaDLL.lua_settop(L, oldTop); }