MCPcopy Create free account
hub / github.com/Tencent/UnLua / FindOrAddThread

Method FindOrAddThread

Plugins/UnLua/Source/UnLua/Private/LuaEnv.cpp:458–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456 }
457
458 int32 FLuaEnv::FindOrAddThread(lua_State* Thread)
459 {
460 int32 ThreadRef = FindThread(Thread);
461 if (ThreadRef == LUA_REFNIL)
462 {
463 int32 Value = lua_pushthread(Thread);
464 if (Value == 1)
465 {
466 lua_pop(Thread, 1);
467 return LUA_REFNIL;
468 }
469
470 ThreadRef = luaL_ref(Thread, LUA_REGISTRYINDEX);
471 AddThread(Thread, ThreadRef);
472 }
473 return ThreadRef;
474 }
475
476 lua_Alloc FLuaEnv::GetLuaAllocator() const
477 {

Callers 2

Class_CallLatentFunctionFunction · 0.80

Calls 2

lua_pushthreadFunction · 0.85
luaL_refFunction · 0.85

Tested by

no test coverage detected