The lua namespace contains support functions for interfacing with the embedded Lua environment. More...
Namespaces | |
| namespace | detail |
Classes | |
| class | LoadConfig |
| Dynamically loads the code necessary to read a configuration file, reads the configuration file, converts it to a properties_ptr, and unloads the code. More... | |
| struct | LuaCallError |
| class | PropertiesToTable |
Typedefs | |
| typedef properties_ptr | fun_type (const std::string &) |
| typedef fun_type * | fun_ptr |
Functions | |
| template<typename R > | |
| R | convert (lua_State *state, int index=-1) |
| template<> | |
| bool | convert< bool > (lua_State *state, int index) |
| template<> | |
| int | convert< int > (lua_State *state, int index) |
| template<> | |
| unsigned int | convert< unsigned int > (lua_State *state, int index) |
| template<> | |
| string | convert< string > (lua_State *state, int index) |
| template<> | |
| const char * | convert< const char * > (lua_State *state, int index) |
| template<> | |
| lua_Number | convert< lua_Number > (lua_State *state, int index) |
| void | push_value (lua_State *state, const bool value) |
| void | push_value (lua_State *state, const int value) |
| void | push_value (lua_State *state, const lua_Number value) |
| void | push_value (lua_State *state, const char *value) |
| void | push_value (lua_State *state, const string &value) |
| void | push_value (lua_State *state, void *value) |
| void | push_value (lua_State *state, const void *value) |
| void | push_values (lua_State *) |
| template<typename P > | |
| void | push_values (lua_State *state, const P &p) |
| template<typename T , typename... P> | |
| void | push_values (lua_State *state, const T &t, const P &...p) |
| template<typename V > | |
| void | set_field (lua_State *state, int index, const V &value, const char *const field) |
| template<typename V > | |
| void | set_field (lua_State *state, int index, const V &value, const string &field) |
| template<typename V > | |
| void | set_field (lua_State *state, int index, const V &value, int n) |
| void | get_global (lua_State *state, const char *const field) |
| void | get_global (lua_State *state, const string &field) |
| template<typename V > | |
| void | set_global (lua_State *state, const V &value, const char *const field) |
| template<typename V > | |
| void | set_global (lua_State *state, const V &value, const string &field) |
| template<typename R > | |
| const R | get_field (const R &default_value, lua_State *state, int index, const char *const field) |
| template<typename R > | |
| const R | get_field (const R &default_value, lua_State *state, int index, const string &field) |
| template<typename R > | |
| const R | get_field (const R &default_value, lua_State *state, int index, int n) |
| template<typename R , typename... P> | |
| const R | get_field (const R &default_value, lua_State *state, int index, const char *const field, P...p) |
| template<typename R > | |
| const R | get_field (lua_State *state, int index, const char *const field) |
| template<typename R > | |
| const R | get_field (lua_State *state, int index, const string &field) |
| template<typename R > | |
| const R | get_field (lua_State *state, int index, int n) |
| template<typename R , typename... P> | |
| const R | get_field (lua_State *state, int index, const char *const field, P...p) |
| template<typename R > | |
| const R | get_value (const R &default_value, lua_State *state, const char *const var) |
| template<typename R > | |
| const R | get_value (const R &default_value, lua_State *state, const string &var) |
| template<typename R , typename... P> | |
| const R | get_value (const R &default_value, lua_State *state, const char *const var, P...p) |
| template<typename R > | |
| const R | get_value (lua_State *state, const char *const var) |
| template<typename R > | |
| const R | get_value (lua_State *state, const string &var) |
| template<typename R , typename... P> | |
| const R | get_value (lua_State *state, const char *const var, P...p) |
| template<typename V > | |
| void | create_value (lua_State *state, const V &value, const char *const var) |
| template<typename V > | |
| void | create_value (lua_State *state, const V &value, const string &var) |
| template<typename V , typename... P> | |
| void | create_value (lua_State *state, const V &value, const char *const var, P...p) |
| template<typename V , typename... P> | |
| void | set_field (lua_State *state, int index, const V &value, const char *const field, P...p) |
| template<typename V > | |
| void | set_value (lua_State *state, const V &value, const char *const var) |
| template<typename V > | |
| void | set_value (lua_State *state, const V &value, const string &var) |
| template<typename V , typename... P> | |
| void | set_value (lua_State *state, const V &value, const char *const var, P...p) |
| template<typename I > | |
| void | prepend_package_path (lua_State *state, const I &begin, const I &end) |
| template<typename... P> | |
| void | pcall_nopop (const int nargs, const int nresults, lua_State *state, P...p) SSRC_DECL_THROW(LuaCallError) |
| Assumes function has already been pushed to top of stack. | |
| template<typename... P> | |
| void | pcall_nopop (const int nresults, lua_State *state, P...p) SSRC_DECL_THROW(LuaCallError) |
| template<typename R , typename... P> | |
| R | pcall_ret (lua_State *state, const P &...p) SSRC_DECL_THROW(LuaCallError) |
| Currently, we support only one return value, but it should be possible to work things out to specify multiple return values and return them via a tuple. | |
| template<typename... P> | |
| void | pcall (lua_State *state, const P &...p) SSRC_DECL_THROW(LuaCallError) |
| template<typename container_type > | |
| void | map_to_table (lua_State *state, const container_type &map) |
| void | table_to_properties (lua_State *state, Properties &properties) |
| Copies a Lua table into a Properties instance. | |
| void | swig_table_to_properties (void *state, Properties &properties) |
| This function is a kluge to work around a SWIG library relocation error. | |
| properties_ptr | load_properties (lua_State *state, const std::string &filename) SSRC_DECL_THROW(LuaCallError) |
| properties_ptr | load_string_properties (lua_State *state, const std::string &code_str) SSRC_DECL_THROW(LuaCallError) |
| void | properties_to_table (const PropertiesToTable &to_table, const Properties &properties) |
| void | properties_to_table (lua_State *state, const Properties &properties) |
| Converts a Properties instance to a Lua table, pushing the resulting table onto the Lua stack. | |
| properties_ptr | load_properties (const std::string &filename) |
| properties_ptr | load_string_properties (const std::string &code_str) |
Detailed Description
The lua namespace contains support functions for interfacing with the embedded Lua environment.
Typedef Documentation
| typedef fun_type* lua::fun_ptr |
Definition at line 33 of file LoadConfig.h.
| typedef properties_ptr lua::fun_type(const std::string &) |
Definition at line 32 of file LoadConfig.h.
Function Documentation
| R lua::convert | ( | lua_State * | state, |
| int | index = -1 |
||
| ) | [inline] |
| bool lua::convert< bool > | ( | lua_State * | state, |
| int | index | ||
| ) | [inline] |
Definition at line 46 of file lua.h.
Referenced by table_to_properties().
| const char* lua::convert< const char * > | ( | lua_State * | state, |
| int | index | ||
| ) | [inline] |
| int lua::convert< int > | ( | lua_State * | state, |
| int | index | ||
| ) | [inline] |
| lua_Number lua::convert< lua_Number > | ( | lua_State * | state, |
| int | index | ||
| ) | [inline] |
Definition at line 69 of file lua.h.
Referenced by table_to_properties().
| string lua::convert< string > | ( | lua_State * | state, |
| int | index | ||
| ) | [inline] |
Definition at line 59 of file lua.h.
Referenced by table_to_properties().
| unsigned int lua::convert< unsigned int > | ( | lua_State * | state, |
| int | index | ||
| ) | [inline] |
| void lua::create_value | ( | lua_State * | state, |
| const V & | value, | ||
| const char *const | var | ||
| ) | [inline] |
Definition at line 352 of file lua.h.
References set_global().
| void lua::create_value | ( | lua_State * | state, |
| const V & | value, | ||
| const string & | var | ||
| ) | [inline] |
Definition at line 359 of file lua.h.
References set_global().
| void lua::create_value | ( | lua_State * | state, |
| const V & | value, | ||
| const char *const | var, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 366 of file lua.h.
References lua::detail::_create_value().
| const R lua::get_field | ( | const R & | default_value, |
| lua_State * | state, | ||
| int | index, | ||
| const char *const | field | ||
| ) | [inline] |
Definition at line 222 of file lua.h.
Referenced by get_field().
| const R lua::get_field | ( | const R & | default_value, |
| lua_State * | state, | ||
| int | index, | ||
| const string & | field | ||
| ) | [inline] |
Definition at line 235 of file lua.h.
References lua::detail::_get_field().
| const R lua::get_field | ( | const R & | default_value, |
| lua_State * | state, | ||
| int | index, | ||
| int | n | ||
| ) | [inline] |
| const R lua::get_field | ( | const R & | default_value, |
| lua_State * | state, | ||
| int | index, | ||
| const char *const | field, | ||
| P... | p | ||
| ) | [inline] |
| const R lua::get_field | ( | lua_State * | state, |
| int | index, | ||
| const char *const | field | ||
| ) | [inline] |
Definition at line 276 of file lua.h.
References get_field().
| const R lua::get_field | ( | lua_State * | state, |
| int | index, | ||
| const string & | field | ||
| ) | [inline] |
Definition at line 281 of file lua.h.
References get_field().
| const R lua::get_field | ( | lua_State * | state, |
| int | index, | ||
| int | n | ||
| ) | [inline] |
Definition at line 286 of file lua.h.
References get_field().
| const R lua::get_field | ( | lua_State * | state, |
| int | index, | ||
| const char *const | field, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 291 of file lua.h.
References get_field().
| void lua::get_global | ( | lua_State * | state, |
| const char *const | field | ||
| ) | [inline] |
Definition at line 196 of file lua.h.
Referenced by get_value(), prepend_package_path(), and set_value().
| void lua::get_global | ( | lua_State * | state, |
| const string & | field | ||
| ) | [inline] |
Definition at line 200 of file lua.h.
References push_value().
| const R lua::get_value | ( | const R & | default_value, |
| lua_State * | state, | ||
| const char *const | var | ||
| ) | [inline] |
| const R lua::get_value | ( | const R & | default_value, |
| lua_State * | state, | ||
| const string & | var | ||
| ) | [inline] |
Definition at line 312 of file lua.h.
References get_global().
| const R lua::get_value | ( | const R & | default_value, |
| lua_State * | state, | ||
| const char *const | var, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 324 of file lua.h.
References get_global().
| const R lua::get_value | ( | lua_State * | state, |
| const char *const | var | ||
| ) | [inline] |
Definition at line 337 of file lua.h.
References get_value().
| const R lua::get_value | ( | lua_State * | state, |
| const string & | var | ||
| ) | [inline] |
Definition at line 342 of file lua.h.
References get_value().
| const R lua::get_value | ( | lua_State * | state, |
| const char *const | var, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 347 of file lua.h.
References get_value().
| properties_ptr lua::load_properties | ( | const std::string & | filename | ) | [inline] |
Definition at line 138 of file lua/Properties.h.
References load_properties().
| properties_ptr lua::load_properties | ( | lua_State * | state, |
| const std::string & | filename | ||
| ) |
Definition at line 211 of file Properties.cc.
Referenced by load_properties(), load_string_properties(), and WSPR_DEFINE_NAMESPACE().
| properties_ptr lua::load_string_properties | ( | const std::string & | code_str | ) | [inline] |
Definition at line 146 of file lua/Properties.h.
References load_string_properties().
| properties_ptr lua::load_string_properties | ( | lua_State * | state, |
| const std::string & | code_str | ||
| ) |
Definition at line 218 of file Properties.cc.
References load_properties().
Referenced by load_string_properties().
| void lua::map_to_table | ( | lua_State * | state, |
| const container_type & | map | ||
| ) |
Definition at line 30 of file map.h.
References push_value(), set_field(), and database::value().
| void lua::pcall | ( | lua_State * | state, |
| const P &... | p | ||
| ) | [inline] |
Definition at line 478 of file lua.h.
References pcall_nopop().
Referenced by renderer::Renderer::clear_template_cache(), relay::Relay::finish_post(), renderer::Renderer::render_and_cache(), renderer::Renderer::uncache_environment(), and renderer::Renderer::uncache_template().
| void lua::pcall_nopop | ( | const int | nargs, |
| const int | nresults, | ||
| lua_State * | state, | ||
| P... | p | ||
| ) | [inline] |
Assumes function has already been pushed to top of stack.
The nargs parameter is to allow you to pre-push values onto the stack.
Definition at line 441 of file lua.h.
References push_values().
Referenced by relay::Relay::finish_post(), renderer::Renderer::load_environment(), pcall(), pcall_nopop(), pcall_ret(), fcgi_lua::ServletRunner::process_fcgi_request(), renderer::Renderer::render_and_cache(), and renderer::Renderer::send_error().
| void lua::pcall_nopop | ( | const int | nresults, |
| lua_State * | state, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 456 of file lua.h.
References pcall_nopop().
| R lua::pcall_ret | ( | lua_State * | state, |
| const P &... | p | ||
| ) | [inline] |
Currently, we support only one return value, but it should be possible to work things out to specify multiple return values and return them via a tuple.
Definition at line 468 of file lua.h.
References pcall_nopop().
| void lua::prepend_package_path | ( | lua_State * | state, |
| const I & | begin, | ||
| const I & | end | ||
| ) | [inline] |
Definition at line 412 of file lua.h.
References get_global(), and set_field().
Referenced by renderer::_lua_init_global_environment_ref(), and fcgi_lua::ServletRunner::ServletRunner().
| void lua::properties_to_table | ( | const PropertiesToTable & | to_table, |
| const Properties & | properties | ||
| ) | [inline] |
Definition at line 105 of file lua/Properties.h.
References lua::PropertiesToTable::state().
Referenced by relay::Relay::finish_post(), and properties_to_table().
| void lua::properties_to_table | ( | lua_State * | state, |
| const Properties & | properties | ||
| ) | [inline] |
Converts a Properties instance to a Lua table, pushing the resulting table onto the Lua stack.
- Parameters:
-
state A pointer to the Lua state in which to return the table. properties The Properties instance to convert.
Definition at line 121 of file lua/Properties.h.
References properties_to_table().
| void lua::push_value | ( | lua_State * | state, |
| const bool | value | ||
| ) | [inline] |
Definition at line 73 of file lua.h.
Referenced by lua::detail::_get_field(), relay::Relay::finish_post(), get_global(), map_to_table(), push_values(), set_field(), and set_global().
| void lua::push_value | ( | lua_State * | state, |
| const int | value | ||
| ) | [inline] |
| void lua::push_value | ( | lua_State * | state, |
| const lua_Number | value | ||
| ) | [inline] |
| void lua::push_value | ( | lua_State * | state, |
| const char * | value | ||
| ) | [inline] |
| void lua::push_value | ( | lua_State * | state, |
| const string & | value | ||
| ) | [inline] |
| void lua::push_value | ( | lua_State * | state, |
| void * | value | ||
| ) | [inline] |
| void lua::push_value | ( | lua_State * | state, |
| const void * | value | ||
| ) | [inline] |
| void lua::push_values | ( | lua_State * | ) | [inline] |
Definition at line 102 of file lua.h.
Referenced by pcall_nopop(), and push_values().
| void lua::push_values | ( | lua_State * | state, |
| const P & | p | ||
| ) | [inline] |
Definition at line 105 of file lua.h.
References push_value().
| void lua::push_values | ( | lua_State * | state, |
| const T & | t, | ||
| const P &... | p | ||
| ) | [inline] |
Definition at line 110 of file lua.h.
References push_value(), and push_values().
| void lua::set_field | ( | lua_State * | state, |
| int | index, | ||
| const V & | value, | ||
| const char *const | field | ||
| ) | [inline] |
Definition at line 116 of file lua.h.
References push_value().
Referenced by lua::detail::_create_value(), lua::detail::_set_value(), map_to_table(), prepend_package_path(), and set_field().
| void lua::set_field | ( | lua_State * | state, |
| int | index, | ||
| const V & | value, | ||
| const string & | field | ||
| ) | [inline] |
Definition at line 124 of file lua.h.
References push_value().
| void lua::set_field | ( | lua_State * | state, |
| int | index, | ||
| const V & | value, | ||
| int | n | ||
| ) | [inline] |
Definition at line 133 of file lua.h.
References push_value().
| void lua::set_field | ( | lua_State * | state, |
| int | index, | ||
| const V & | value, | ||
| const char *const | field, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 375 of file lua.h.
References set_field().
| void lua::set_global | ( | lua_State * | state, |
| const V & | value, | ||
| const char *const | field | ||
| ) | [inline] |
Definition at line 206 of file lua.h.
References push_value().
Referenced by create_value(), and set_value().
| void lua::set_global | ( | lua_State * | state, |
| const V & | value, | ||
| const string & | field | ||
| ) | [inline] |
Definition at line 214 of file lua.h.
References push_value().
| void lua::set_value | ( | lua_State * | state, |
| const V & | value, | ||
| const char *const | var | ||
| ) | [inline] |
Definition at line 390 of file lua.h.
References set_global().
Referenced by utility::Properties::create_primitive_property_vector(), utility::Properties::create_property_vector(), relay::Relay::finish_post(), utility::Properties::operator=(), utility::Properties::Properties(), and renderer::Renderer::render_and_cache().
| void lua::set_value | ( | lua_State * | state, |
| const V & | value, | ||
| const string & | var | ||
| ) | [inline] |
Definition at line 397 of file lua.h.
References set_global().
| void lua::set_value | ( | lua_State * | state, |
| const V & | value, | ||
| const char *const | var, | ||
| P... | p | ||
| ) | [inline] |
Definition at line 402 of file lua.h.
References lua::detail::_set_value(), and get_global().
| void lua::swig_table_to_properties | ( | void * | state, |
| Properties & | properties | ||
| ) |
This function is a kluge to work around a SWIG library relocation error.
For some reason, table_to_properties doesn't resolve when called within a SWIG wrapper function. Removing lua_State* from the function signature allows the function to be located, which then resolves table_to_properties within the same relocation unit instead of crossing module boundaries.
Definition at line 180 of file Properties.cc.
References table_to_properties().
| void lua::table_to_properties | ( | lua_State * | state, |
| Properties & | properties | ||
| ) |
Copies a Lua table into a Properties instance.
Tables must either be pure arrays of primitive values, pure arrays of tables, or a zero-length table with key value pairs where all the keys are strings.
- Parameters:
-
state A pointer to the Lua state containing the table to convert at the top of the stack. properties The Properties instance to convert.
Definition at line 110 of file Properties.cc.
References convert< bool >(), convert< lua_Number >(), and convert< string >().
Referenced by swig_table_to_properties().