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

Function ll_register

Source/Misc/lua/src/lua.c:13030–13047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13028
13029
13030static void **ll_register (lua_State *L, const char *path) {
13031void **plib;
13032lua_pushfstring(L, "%s%s", LIBPREFIX, path);
13033lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */
13034if (!lua_isnil(L, -1)) /* is there an entry? */
13035plib = (void **)lua_touserdata(L, -1);
13036else { /* no entry yet; create one */
13037lua_pop(L, 1);
13038plib = (void **)lua_newuserdata(L, sizeof(const void *));
13039*plib = NULL;
13040luaL_getmetatable(L, "_LOADLIB");
13041lua_setmetatable(L, -2);
13042lua_pushfstring(L, "%s%s", LIBPREFIX, path);
13043lua_pushvalue(L, -2);
13044lua_settable(L, LUA_REGISTRYINDEX);
13045}
13046return plib;
13047}
13048
13049
13050/*

Callers 1

ll_loadfuncFunction · 0.85

Calls 7

lua_pushfstringFunction · 0.85
lua_gettableFunction · 0.85
lua_touserdataFunction · 0.85
lua_newuserdataFunction · 0.85
lua_setmetatableFunction · 0.85
lua_pushvalueFunction · 0.85
lua_settableFunction · 0.85

Tested by

no test coverage detected