garrysmod-issues
garrysmod-issues copied to clipboard
Binary module functions using ILuaBase from official interface crash when called from coroutine
Simple to reproduce, download any ol' binary module that uses the official gmod module base and call a function created from it within a coroutine.
u: This is probably caused by ILuaBase's methods using the wrong lua_State reference when within a coroutine.
Lua interfaces appear to hold a pointer to the global Lua state which is then used by their methods rather than the current thread's Lua state
https://github.com/garrynewman/gmod-module-base/issues/3
One example to this issue is in my thread. Using tmysql4 database from coroutine gives me
[ERROR] gamemodes/w/gamemode/corotest.lua:55: bad argument #1 to 'db_calls' (ţł│UÇ8C♦am files\ste3 expected, got no value)
- db_calls - [C]:-1
- G - gamemodes/w/gamemode/corotest.lua:55
- unknown - lua_run:1
Calling MsgC() in the coroutine supresses the error message, but it is kinda a hack fix.
This was fixed?
Was this fixed? I seem to be able to use luasocket functions in coroutines just fine.