MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / main_thread

Function main_thread

extlibs/sol3/include/sol/sol.hpp:8550–8568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8548 } // namespace stack
8549
8550 inline lua_State* main_thread(lua_State* L, lua_State* backup_if_unsupported = nullptr) {
8551#if SOL_LUA_VERSION < 502
8552 if (L == nullptr)
8553 return backup_if_unsupported;
8554 lua_getglobal(L, detail::default_main_thread_name());
8555 auto pp = stack::pop_n(L, 1);
8556 if (type_of(L, -1) == type::thread) {
8557 return lua_tothread(L, -1);
8558 }
8559 return backup_if_unsupported;
8560#else
8561 if (L == nullptr)
8562 return backup_if_unsupported;
8563 lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD);
8564 lua_State* Lmain = lua_tothread(L, -1);
8565 lua_pop(L, 1);
8566 return Lmain;
8567#endif // Lua 5.2+ has the main thread unqualified_getter
8568 }
8569
8570 namespace detail {
8571 struct global_tag {

Callers 3

pick_main_threadFunction · 0.85
getMethod · 0.85
get_default_handlerFunction · 0.85

Calls 5

lua_getglobalFunction · 0.85
pop_nFunction · 0.85
type_ofFunction · 0.85
lua_tothreadFunction · 0.85
lua_rawgetiFunction · 0.85

Tested by

no test coverage detected