MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / ll_register

Function ll_register

deps/lua/src/loadlib.c:262–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261
262static void **ll_register (lua_State *L, const char *path) {
263 void **plib;
264 lua_pushfstring(L, "%s%s", LIBPREFIX, path);
265 lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */
266 if (!lua_isnil(L, -1)) /* is there an entry? */
267 plib = (void **)lua_touserdata(L, -1);
268 else { /* no entry yet; create one */
269 lua_pop(L, 1);
270 plib = (void **)lua_newuserdata(L, sizeof(const void *));
271 *plib = NULL;
272 luaL_getmetatable(L, "_LOADLIB");
273 lua_setmetatable(L, -2);
274 lua_pushfstring(L, "%s%s", LIBPREFIX, path);
275 lua_pushvalue(L, -2);
276 lua_settable(L, LUA_REGISTRYINDEX);
277 }
278 return plib;
279}
280
281
282/*

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