MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaL_setfuncs

Function luaL_setfuncs

ThirdParty/lua/lua/lauxlib.c:863–873  ·  view source on GitHub ↗

** set functions from list 'l' into table at top - 'nup'; each ** function gets the 'nup' elements at the top as upvalues. ** Returns with only the table at the stack. */

Source from the content-addressed store, hash-verified

861** Returns with only the table at the stack.
862*/
863LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
864 luaL_checkstack(L, nup, "too many upvalues");
865 for (; l->name != NULL; l++) { /* fill the table with given functions */
866 int i;
867 for (i = 0; i < nup; i++) /* copy upvalues to the top */
868 lua_pushvalue(L, -nup);
869 lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
870 lua_setfield(L, -(nup + 2), l->name);
871 }
872 lua_pop(L, nup); /* remove upvalues */
873}
874
875
876/*

Callers 4

luaopen_baseFunction · 0.85
luaL_openlibFunction · 0.85
luaopen_packageFunction · 0.85
createmetaFunction · 0.85

Calls 4

luaL_checkstackFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushcclosureFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected