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

Method AddSearcher

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

Source from the content-addressed store, hash-verified

599 }
600
601 void FLuaEnv::AddSearcher(lua_CFunction Searcher, int Index) const
602 {
603 lua_getglobal(L, "package");
604 lua_getfield(L, -1, "searchers");
605 lua_remove(L, -2);
606 if (!lua_istable(L, -1))
607 {
608 UE_LOG(LogUnLua, Warning, TEXT("Invalid package.serachers!"));
609 return;
610 }
611
612 const uint32 Len = lua_rawlen(L, -1);
613 Index = Index < 0 ? (int)(Len + Index + 2) : Index;
614 for (int e = (int)Len + 1; e > Index; e--)
615 {
616 lua_rawgeti(L, -1, e - 1);
617 lua_rawseti(L, -2, e);
618 }
619
620 lua_pushlightuserdata(L, (void*)this);
621 lua_pushcclosure(L, Searcher, 1);
622 lua_rawseti(L, -2, Index);
623 lua_pop(L, 1);
624 }
625
626 void FLuaEnv::OnAsyncLoadingFlushUpdate()
627 {

Callers

nothing calls this directly

Calls 6

lua_getglobalFunction · 0.85
lua_getfieldFunction · 0.85
lua_rawgetiFunction · 0.85
lua_rawsetiFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushcclosureFunction · 0.85

Tested by

no test coverage detected