public LuaSvr(string main) { luaState = new LuaState(); GameObject go = new GameObject("LuaSvrProxy"); lgo = go.AddComponent <LuaSvrGameObject>(); GameObject.DontDestroyOnLoad(go); lgo.state = luaState; lgo.onUpdate = this.tick; LuaState.pcall(luaState.L, init); start(main); if (LuaDLL.lua_gettop(luaState.L) != errorReported) { Debug.LogError("Some function not remove temp value from lua stack. You should fix it."); errorReported = LuaDLL.lua_gettop(luaState.L); } }