Is there a specific reason that metamethods cannot yield? #771
-
I made a ROBLOX devforum post about this topic, and decided to bring it here to the actual development community of Luau to get a clearer answer regarding this issue. I'm currently working on a system where I need to wait for data to be present then return the int lua_yield(lua_State* L, int nresults)
{
if (L->nCcalls > L->baseCcalls)
luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
L->base = L->top - nresults; // protect stack slots below
L->status = LUA_YIELD;
return -1;
} meaning that (according to struct lua_State) the number of nested C calls cannot be more than the number of nested C calls when resuming coroutine, which honestly I'm not sure what that means. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This question is answered in the "Compatibility" page of Luau website: https://luau-lang.org/compatibility#lua-52 |
Beta Was this translation helpful? Give feedback.
This question is answered in the "Compatibility" page of Luau website: https://luau-lang.org/compatibility#lua-52