When calling an ii function for the first time from within a clock coroutine, it would load the file but fail to return the table to the coroutine, abandoning it to the GC.
This was caused by the custom dofile implementation using a global pointer to the lua_State, rather than the received pointer from the VM. This breaks when called from a coroutine because a lua coroutine is essentially a lua_State object wrapped in a 'LUA_TTHREAD' object. Thus we would push the loaded table into the main thread's stack, rather than the coroutine's stack.
Additionally, a new 'strip_debug' flag is added per lua-library in lib/lualink.c. If you are debugging an issue in any of the on-board lua libraries, set the flag to false for that file so you get accurate line-numbers when errors arise.
Fixes #419
When calling an
ii
function for the first time from within aclock
coroutine, it would load the file but fail to return the table to the coroutine, abandoning it to the GC.This was caused by the custom
dofile
implementation using a global pointer to thelua_State
, rather than the received pointer from the VM. This breaks when called from a coroutine because a lua coroutine is essentially alua_State
object wrapped in a 'LUA_TTHREAD' object. Thus we would push the loaded table into the main thread's stack, rather than the coroutine's stack.Additionally, a new 'strip_debug' flag is added per lua-library in
lib/lualink.c
. If you are debugging an issue in any of the on-board lua libraries, set the flag tofalse
for that file so you get accurate line-numbers when errors arise.