MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / ll_register

Function ll_register

other_src/lua/src/loadlib.cpp:277–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275
276
277static void **ll_register (lua_State *L, const char *path) {
278 void **plib;
279 lua_pushfstring(L, "%s%s", LIBPREFIX, path);
280 lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */
281 if (!lua_isnil(L, -1)) /* is there an entry? */
282 plib = (void **)lua_touserdata(L, -1);
283 else { /* no entry yet; create one */
284 lua_pop(L, 1);
285 plib = (void **)lua_newuserdata(L, sizeof(const void *));
286 *plib = NULL;
287 luaL_getmetatable(L, "_LOADLIB");
288 lua_setmetatable(L, -2);
289 lua_pushfstring(L, "%s%s", LIBPREFIX, path);
290 lua_pushvalue(L, -2);
291 lua_settable(L, LUA_REGISTRYINDEX);
292 }
293 return plib;
294}
295
296
297/*

Callers 1

ll_loadfuncFunction · 0.70

Calls 7

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

Tested by

no test coverage detected