public LuaThreadWrapper(LuaFunction function) : base() { Logger.Log(string.Format("LuaThreadWrapper.ctor/1: {0}", LuaNativeMethods.lua_gettop(function.VariablePointer))); this.state = LuaState.Get(function.VariablePointer); this.thread = LuaNativeMethods.lua_newthread(function.VariablePointer); this.valueref = LuaNativeMethods.luaL_ref(function.VariablePointer, LuaIndexes.LUARegistryIndex); function.Push(function.VariablePointer); LuaNativeMethods.lua_xmove(function.VariablePointer, this.thread, 1); Logger.Log(string.Format("LuaThreadWrapper.ctor/2: {0}", LuaNativeMethods.lua_gettop(function.VariablePointer))); }