MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / do_set_package_preload

Function do_set_package_preload

Source/Misc/luabind/src/set_package_preload.cpp:49–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47// - none
48
49static int do_set_package_preload(lua_State* L)
50{
51 // Note: Use ordinary set/get instead of the raw variants, because this
52 // function should not be performance sensitive anyway.
53 lua_pushglobaltable(L);
54 lua_getfield(L, -1, "package");
55 lua_remove(L, -2); // Remove global table.
56 lua_getfield(L, -1, "preload");
57 lua_remove(L, -2); // Remove package table.
58 lua_insert(L, -3); // Move package.preload beneath key and value.
59 lua_settable(L, -3); // package.preload[modulename] = loader
60 return 0;
61}
62
63static int proxy_loader(lua_State* L)
64{

Callers

nothing calls this directly

Calls 4

lua_getfieldFunction · 0.85
lua_removeFunction · 0.85
lua_insertFunction · 0.85
lua_settableFunction · 0.85

Tested by

no test coverage detected