[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: coroutine.resume() crash
- From: John Dunn <John.Dunn@...>
- Date: Mon, 12 Sep 2022 16:32:20 +0000
> Xmilia Hermit <xmilia.hermit@gmail.com> said
> Instead of using the current Lua state with the timer the main Lua state should call the callback.
( sorry, missed your answer before, got caught in my spam net )
Thanks, this fixed the problem. Is it correct to always use the lua_State* when it's supplied as the argument to a callback ( module methods, metatable methods, _gc, etc ) and to always use the 'base' lua when calling into Lua from outside code ( ie my callback function )?
An example which allows the user to create a timer userdata object-
Timer.New() - returns userdata and assigns metatable. Use supplied lua_State?
timer:Start() - metatable function to start timer. Use supplied lua_State?
timer:_gc - metatable garbage collection. Use supplied lua_State?
timer->callback() - external call back into Lua