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.
|
static |
Definition at line 46 of file lua_cpp_function.cpp.
References cpp_function, d, and ERR_LUA.
Referenced by register_metatable().
|
static |
Definition at line 104 of file lua_cpp_function.cpp.
References cpp_function, and f.
Referenced by push_closure().
|
static |
Definition at line 36 of file lua_cpp_function.cpp.
References cpp_function, and f.
Referenced by register_metatable().
|
static |
Definition at line 60 of file lua_cpp_function.cpp.
References cpp_function, and d.
Referenced by register_metatable().
void lua_cpp::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.
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 110 of file lua_cpp_function.cpp.
References f, intf_closure_dispatcher(), and push_function().
Referenced by game_lua_kernel::impl_theme_items_get(), and set_functions().
void lua_cpp::push_function | ( | lua_State * | L, |
const lua_function & | f | ||
) |
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 87 of file lua_cpp_function.cpp.
References cpp_function, and f.
Referenced by push_closure(), application_lua_kernel::thread::run_script(), and set_functions().
void lua_cpp::register_metatable | ( | lua_State * | L | ) |
Definition at line 70 of file lua_cpp_function.cpp.
References cpp_function, intf_cleanup(), intf_dispatcher(), and intf_tostring().
Referenced by lua_kernel_base::lua_kernel_base().
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().
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 93 of file lua_cpp_function.cpp.
References push_function().
Referenced by game_lua_kernel::game_lua_kernel(), lua_gui2::luaW_open(), and 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 117 of file lua_cpp_function.cpp.
References i, and push_closure().
char const* lua_cpp::cpp_function = "CPP_Function" |
Definition at line 34 of file lua_cpp_function.cpp.
Referenced by intf_cleanup(), intf_closure_dispatcher(), intf_dispatcher(), intf_tostring(), push_function(), and register_metatable().