MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaL_setfuncs

Function luaL_setfuncs

extlibs/sol3/include/sol/sol.hpp:2652–2663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2650}
2651
2652COMPAT53_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) {
2653 luaL_checkstack(L, nup + 1, "too many upvalues");
2654 for (; l->name != NULL; l++) { /* fill the table with given functions */
2655 int i;
2656 lua_pushstring(L, l->name);
2657 for (i = 0; i < nup; i++) /* copy upvalues to the top */
2658 lua_pushvalue(L, -(nup + 1));
2659 lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
2660 lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */
2661 }
2662 lua_pop(L, nup); /* remove upvalues */
2663}
2664
2665COMPAT53_API void luaL_setmetatable(lua_State *L, const char *tname) {
2666 luaL_checkstack(L, 1, "not enough stack slots");

Callers 3

push_deepMethod · 0.70
operator()Method · 0.70
set_undefined_methods_onFunction · 0.70

Calls 5

lua_pushstringFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushcclosureFunction · 0.85
lua_settableFunction · 0.85
luaL_checkstackFunction · 0.70

Tested by

no test coverage detected