MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / addtoclib

Function addtoclib

source/extern/lua/loadlib.c:331–338  ·  view source on GitHub ↗

** registry.CLIBS[path] = plib -- for queries ** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries */

Source from the content-addressed store, hash-verified

329** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries
330*/
331static void addtoclib (lua_State *L, const char *path, void *plib) {
332 lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS);
333 lua_pushlightuserdata(L, plib);
334 lua_pushvalue(L, -1);
335 lua_setfield(L, -3, path); /* CLIBS[path] = plib */
336 lua_rawseti(L, -2, luaL_len(L, -2) + 1); /* CLIBS[#CLIBS + 1] = plib */
337 lua_pop(L, 1); /* pop CLIBS table */
338}
339
340
341/*

Callers 1

lookforfuncFunction · 0.85

Calls 5

lua_rawgetpFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85
lua_rawsetiFunction · 0.85

Tested by

no test coverage detected