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

Function luaL_requiref

Libs/sol/sol.hpp:3721–3737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3719}
3720
3721COMPAT53_API void luaL_requiref(lua_State* L, const char* modname, lua_CFunction openf, int glb) {
3722 luaL_checkstack(L, 3, "not enough stack slots available");
3723 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
3724 if (lua_getfield(L, -1, modname) == LUA_TNIL) {
3725 lua_pop(L, 1);
3726 lua_pushcfunction(L, openf);
3727 lua_pushstring(L, modname);
3728 lua_call(L, 1, 1);
3729 lua_pushvalue(L, -1);
3730 lua_setfield(L, -3, modname);
3731 }
3732 if (glb) {
3733 lua_pushvalue(L, -1);
3734 lua_setglobal(L, modname);
3735 }
3736 lua_replace(L, -2);
3737}
3738
3739#endif /* Lua 5.1 and 5.2 */
3740

Callers 2

open_librariesMethod · 0.85
requireMethod · 0.85

Calls 2

luaL_checkstackFunction · 0.85
luaL_getsubtableFunction · 0.85

Tested by

no test coverage detected