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

Function Open

Plugins/UnLua/Source/UnLua/Private/UnLuaLib.cpp:234–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 }
233
234 int Open(lua_State* L)
235 {
236 lua_register(L, "print", LogInfo);
237 luaL_requiref(L, "UnLua", LuaOpen, 1);
238 luaL_dostring(L, R"(
239 setmetatable(UnLua, {
240 __index = function(t, k)
241 local ok, result = pcall(require, "UnLua." .. tostring(k))
242 if ok then
243 rawset(t, k, result)
244 return result
245 else
246 t.LogWarn(string.format("failed to load module UnLua.%s\n%s", k, result))
247 end
248 end
249 })
250 )");
251
252#if UNLUA_WITH_HOT_RELOAD
253 luaL_dostring(L, R"(
254 pcall(function() _G.require = require('UnLua.HotReload').require end)
255 )");
256#endif
257
258 LegacySupport(L);
259 return 1;
260 }
261
262 FString GetPackagePath(lua_State* L)
263 {

Callers 1

FLuaEnvMethod · 0.85

Calls 2

luaL_requirefFunction · 0.85
LegacySupportFunction · 0.85

Tested by

no test coverage detected