godot_luaAPI icon indicating copy to clipboard operation
godot_luaAPI copied to clipboard

can't resume a sub-environment

Open BestestHD opened this issue 2 years ago • 0 comments

to preface, sorry about all the issues 😅 i'm trying to put together a game extensively using lua but these issues are very problematic (except the pull_variant one which i've learned to work around fortunately) this one's pretty self-explanatory, if I load a string into a thread reading

_ENV = game
print(9000)
wait_timer(2.0)
print(2000)

it never prints 2000, only 9000 (i've tried a myriad of different ways, including just calling yield, waiting in gdscript, then resuming the thread. nothing) all relevant functions are exposed to the table/environment of course.

evidently, execution does stop, so i think it's an issue with LuaThread.resume? i'd guess it's only resuming execution of the global environment. i think that some method of assigning a thread an environment from GDScript would be ideal and circumvent this issue, but there's probably some better way... idk (there's also no equivalent of push_variant/pull_variant for a sub-environment but that's not a big deal just requires a bit of extra code haha)

BestestHD avatar Jul 18 '22 14:07 BestestHD