How to get all lua_states? #1305
-
For debug purpose, I need to get all running lua_states. In normal lua, we can traverse allgc in global_State to get it. But in luau the global_State doesn't have allgc, so how can I get all lua_states? |
Beta Was this translation helpful? Give feedback.
Answered by
vegorov-rbx
Jun 25, 2024
Replies: 1 comment
-
There is no API to traverse all states. Anyway, you use luaM_visitgco(L, proto, [](void* context, lua_Page* page, GCObject* gco) {
if (gco->gch.tt != LUA_TTHREAD)
return false;
lua_State* th = gco2th(gco);
return false;
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
heanrum
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is no API to traverse all states.
There's actually no public API in Lua for this as well, looking into internal details might require rework on every update as that's not a stable API.
Starting from Lua 5.2,
allgc
doesn't actually link all collectible objects.Anyway, you use
luaM_visitgco
.