| 2650 | } |
| 2651 | |
| 2652 | COMPAT53_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 | |
| 2665 | COMPAT53_API void luaL_setmetatable(lua_State *L, const char *tname) { |
| 2666 | luaL_checkstack(L, 1, "not enough stack slots"); |
no test coverage detected