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

Function luaL_requiref

extlibs/sol3/include/sol/sol.hpp:3196–3213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3194}
3195
3196COMPAT53_API void luaL_requiref(lua_State *L, const char *modname,
3197 lua_CFunction openf, int glb) {
3198 luaL_checkstack(L, 3, "not enough stack slots available");
3199 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
3200 if (lua_getfield(L, -1, modname) == LUA_TNIL) {
3201 lua_pop(L, 1);
3202 lua_pushcfunction(L, openf);
3203 lua_pushstring(L, modname);
3204 lua_call(L, 1, 1);
3205 lua_pushvalue(L, -1);
3206 lua_setfield(L, -3, modname);
3207 }
3208 if (glb) {
3209 lua_pushvalue(L, -1);
3210 lua_setglobal(L, modname);
3211 }
3212 lua_replace(L, -2);
3213}
3214
3215#endif /* Lua 5.1 and 5.2 */
3216

Callers 2

open_librariesMethod · 0.70
requireMethod · 0.70

Calls 7

lua_getfieldFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85
lua_setglobalFunction · 0.85
luaL_checkstackFunction · 0.70
luaL_getsubtableFunction · 0.70

Tested by

no test coverage detected