MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_setfuncs

Function luaL_setfuncs

third-party/lua-5.5.0/src/lauxlib.c:965–979  ·  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

963** Returns with only the table at the stack.
964*/
965LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
966 luaL_checkstack(L, nup, "too many upvalues");
967 for (; l->name != NULL; l++) { /* fill the table with given functions */
968 if (l->func == NULL) /* placeholder? */
969 lua_pushboolean(L, 0);
970 else {
971 int i;
972 for (i = 0; i < nup; i++) /* copy upvalues to the top */
973 lua_pushvalue(L, -nup);
974 lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
975 }
976 lua_setfield(L, -(nup + 2), l->name);
977 }
978 lua_pop(L, nup); /* remove upvalues */
979}
980
981
982/*

Callers 6

luaopen_baseFunction · 0.70
setrandfuncFunction · 0.70
createmetatableFunction · 0.70
newboxFunction · 0.70
luaopen_packageFunction · 0.70
createmetaFunction · 0.70

Calls 5

luaL_checkstackFunction · 0.70
lua_pushbooleanFunction · 0.70
lua_pushvalueFunction · 0.70
lua_pushcclosureFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected