void set_functions( lua_State* L, const lua_cpp::Reg * l) { luaL_checkversion(L); for (; l->name != NULL; l++) { /* fill the table with given functions */ push_function(L, l->func); lua_setfield(L, -2, l->name); } }
void set_functions( lua_State* L, const std::vector<lua_cpp::Reg>& functions) { luaL_checkversion(L); for (const lua_cpp::Reg& l : functions) { /* fill the table with given functions */ if (l.name != nullptr) { push_function(L, l.func); lua_setfield(L, -2, l.name); } } }
static void op_push_function(int byte, struct thread *thread) { push_function(thread, decode_arg(thread)); }
static void op_push_function_immed(int byte, struct thread *thread) { push_function(thread, byte & 0xf); }
void push_closure( lua_State* L, const lua_function & f, int nup) { push_function(L, f); lua_insert(L, -(1+nup)); //move the function beneath the upvalues lua_pushcclosure(L, &intf_closure_dispatcher, 1+nup); }