Classes | |
struct | Reg |
Typedefs | |
typedef std::function< int(lua_State *)> | lua_function |
Functions | |
static int | intf_dispatcher (lua_State *L) |
static int | intf_cleanup (lua_State *L) |
static int | intf_tostring (lua_State *L) |
void | register_metatable (lua_State *L) |
void | push_function (lua_State *L, const lua_function &f) |
Pushes a std::function wrapper object onto the stack. More... | |
void | set_functions (lua_State *L, const std::vector< lua_cpp::Reg > &functions) |
Analogous to lua_setfuncs, it registers a collection of function wrapper objects into a table, using push_function. More... | |
static int | intf_closure_dispatcher (lua_State *L) |
void | push_closure (lua_State *L, const lua_function &f, int nup) |
Pushes a closure which retains a std::function object as its first up-value. More... | |
void | set_functions (lua_State *L, const std::vector< lua_cpp::Reg > &functions, int nup) |
Analogous to lua_setfuncs and set_functions above, but pushes closures. More... | |
template<int N> | |
void | set_functions (lua_State *L, const lua_cpp::Reg(&functions)[N]) |
Analogous to lua_setfuncs, it registers a collection of function wrapper objects into a table, using push_function. More... | |
template<int N> | |
void | set_functions (lua_State *L, const lua_cpp::Reg(&functions)[N], int nup) |
Analogous to lua_setfuncs and set_functions above, but pushes closures. More... | |
Variables | |
char const * | cpp_function = "CPP_Function" |
typedef std::function<int(lua_State*)> lua_cpp::lua_function |
Definition at line 136 of file lua_cpp_function.hpp.
Definition at line 45 of file lua_cpp_function.cpp.
References d, ERR_LUA, lua_error(), lua_pushstring(), lua_type(), lua_typename(), and luaL_testudata().
Referenced by register_metatable().
Definition at line 102 of file lua_cpp_function.cpp.
References lua_upvalueindex, and luaL_checkudata().
Referenced by push_closure().
Definition at line 35 of file lua_cpp_function.cpp.
References lua_remove(), and luaL_checkudata().
Referenced by register_metatable().
Definition at line 59 of file lua_cpp_function.cpp.
References d, lua_pushstring(), and luaL_checkudata().
Referenced by register_metatable().
Pushes a closure which retains a std::function object as its first up-value.
Note that this is NOT strictly compatible with the lua c function push_closure – if you request additional upvalues they will be indexed starting at 2 rather than 1.
Note that unlike push_function above this results in a function and not userdata being pushed on the stack.
Definition at line 108 of file lua_cpp_function.cpp.
References intf_closure_dispatcher(), lua_insert(), lua_pushcclosure(), and push_function().
Referenced by game_lua_kernel::impl_theme_items_get(), and set_functions().
Pushes a std::function wrapper object onto the stack.
It does not support up-values. If you need that use push_closure (a little slower).
NOTE: This object has type userdata, not function. Its metatable has a call operator. If this is not sufficient for your needs then use push_closure.
Definition at line 84 of file lua_cpp_function.cpp.
References lua_newuserdata(), and luaL_setmetatable().
Referenced by push_closure(), application_lua_kernel::thread::run_script(), and set_functions().
Definition at line 69 of file lua_cpp_function.cpp.
References intf_cleanup(), intf_dispatcher(), intf_tostring(), lua_pop, lua_pushcfunction, lua_pushvalue(), lua_setfield(), and luaL_newmetatable().
Referenced by lua_kernel_base::lua_kernel_base().
void lua_cpp::set_functions | ( | lua_State * | L, |
const std::vector< lua_cpp::Reg > & | functions | ||
) |
Analogous to lua_setfuncs, it registers a collection of function wrapper objects into a table, using push_function.
The note above applies.
Definition at line 91 of file lua_cpp_function.cpp.
References lua_setfield(), luaL_checkversion, and push_function().
Referenced by set_functions().
void lua_cpp::set_functions | ( | lua_State * | L, |
const std::vector< lua_cpp::Reg > & | functions, | ||
int | nup | ||
) |
Analogous to lua_setfuncs and set_functions above, but pushes closures.
NOTE: set_functions(L, l, 0) is NOT the same as set_functions(L, l), as the latter produces userdata and the former doesn't.
Definition at line 115 of file lua_cpp_function.cpp.
References i, lua_pop, lua_pushvalue(), lua_setfield(), luaL_checkstack(), luaL_checkversion, and push_closure().
void lua_cpp::set_functions | ( | lua_State * | L, |
const lua_cpp::Reg(&) | functions[N] | ||
) |
Analogous to lua_setfuncs, it registers a collection of function wrapper objects into a table, using push_function.
The note above applies.
Definition at line 169 of file lua_cpp_function.hpp.
References i, and set_functions().
void lua_cpp::set_functions | ( | lua_State * | L, |
const lua_cpp::Reg(&) | functions[N], | ||
int | nup | ||
) |
Analogous to lua_setfuncs and set_functions above, but pushes closures.
NOTE: set_functions(L, l, 0) is NOT the same as set_functions(L, l), as the latter produces userdata and the former doesn't.
Definition at line 204 of file lua_cpp_function.hpp.
References i, and set_functions().
char const* lua_cpp::cpp_function = "CPP_Function" |
Definition at line 33 of file lua_cpp_function.cpp.