Savarese Software Research Corporation
lua.h File Reference
#include <lua.hpp>
#include <ssrc/wispers-packages.h>
#include <string>
#include <stdexcept>
Include dependency graph for lua.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LuaCallError

Namespaces

namespace  Lua
 The Lua C API from <lua.hpp> can be accessed via the Lua namespace if required, but it is intended for internal use by the library to avoid polluting the global namespace.
namespace  detail

Functions

template<typename 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 detail::_get_field (lua_State *state, int index, const char *const field)
void detail::_get_field (lua_State *state, int index, const string &field)
template<typename V >
void detail::_create_value (lua_State *state, const V &value, const char *const field)
template<typename V >
void detail::_create_value (lua_State *state, const V &value, const string &field)
template<typename V , typename... P>
void detail::_create_value (lua_State *state, const V &value, const char *const field, P...p)
template<typename V >
void detail::_set_value (lua_State *state, const V &value, const char *const field)
template<typename V >
void detail::_set_value (lua_State *state, const V &value, const string &field)
template<typename V , typename... P>
void detail::_set_value (lua_State *state, const V &value, const char *const field, P...p)
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>
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)

Function Documentation

template<typename R >
R convert ( lua_State *  state,
int  index = -1 
) [inline]
template<>
bool convert< bool > ( lua_State *  state,
int  index 
) [inline]

Definition at line 46 of file lua.h.

Referenced by table_to_properties().

template<>
const char* convert< const char * > ( lua_State *  state,
int  index 
) [inline]

Definition at line 65 of file lua.h.

template<>
int convert< int > ( lua_State *  state,
int  index 
) [inline]

Definition at line 50 of file lua.h.

template<>
lua_Number convert< lua_Number > ( lua_State *  state,
int  index 
) [inline]

Definition at line 69 of file lua.h.

Referenced by table_to_properties().

template<>
string convert< string > ( lua_State *  state,
int  index 
) [inline]

Definition at line 59 of file lua.h.

Referenced by table_to_properties().

template<>
unsigned int convert< unsigned int > ( lua_State *  state,
int  index 
) [inline]

Definition at line 55 of file lua.h.

template<typename V >
void create_value ( lua_State *  state,
const V &  value,
const char *const  var 
) [inline]

Definition at line 352 of file lua.h.

References set_global().

template<typename V >
void create_value ( lua_State *  state,
const V &  value,
const string var 
) [inline]

Definition at line 359 of file lua.h.

References set_global().

template<typename V , typename... P>
void create_value ( lua_State *  state,
const V &  value,
const char *const  var,
P...  p 
) [inline]

Definition at line 366 of file lua.h.

References detail::_create_value().

template<typename R >
const R 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().

template<typename R >
const R get_field ( const R &  default_value,
lua_State *  state,
int  index,
const string field 
) [inline]

Definition at line 235 of file lua.h.

References detail::_get_field().

template<typename R >
const R get_field ( const R &  default_value,
lua_State *  state,
int  index,
int  n 
) [inline]

Definition at line 248 of file lua.h.

template<typename R , typename... P>
const R get_field ( const R &  default_value,
lua_State *  state,
int  index,
const char *const  field,
P...  p 
) [inline]

Definition at line 261 of file lua.h.

template<typename R >
const R get_field ( lua_State *  state,
int  index,
const char *const  field 
) [inline]

Definition at line 276 of file lua.h.

References get_field().

template<typename R >
const R get_field ( lua_State *  state,
int  index,
const string field 
) [inline]

Definition at line 281 of file lua.h.

References get_field().

template<typename R >
const R get_field ( lua_State *  state,
int  index,
int  n 
) [inline]

Definition at line 286 of file lua.h.

References get_field().

template<typename R , typename... P>
const R 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 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 get_global ( lua_State *  state,
const string field 
) [inline]

Definition at line 200 of file lua.h.

References push_value().

template<typename R >
const R get_value ( const R &  default_value,
lua_State *  state,
const char *const  var 
) [inline]

Definition at line 300 of file lua.h.

References get_global().

Referenced by get_value().

template<typename R >
const R get_value ( const R &  default_value,
lua_State *  state,
const string var 
) [inline]

Definition at line 312 of file lua.h.

References get_global().

template<typename R , typename... P>
const R 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().

template<typename R >
const R get_value ( lua_State *  state,
const char *const  var 
) [inline]

Definition at line 337 of file lua.h.

References get_value().

template<typename R >
const R get_value ( lua_State *  state,
const string var 
) [inline]

Definition at line 342 of file lua.h.

References get_value().

template<typename R , typename... P>
const R get_value ( lua_State *  state,
const char *const  var,
P...  p 
) [inline]

Definition at line 347 of file lua.h.

References get_value().

template<typename... P>
void pcall ( lua_State *  state,
const P &...  p 
) [inline]
template<typename... P>
void 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::finish_post(), Renderer::load_environment(), pcall(), pcall_nopop(), pcall_ret(), ServletRunner::process_fcgi_request(), Renderer::render_and_cache(), and Renderer::send_error().

template<typename... P>
void pcall_nopop ( const int  nresults,
lua_State *  state,
P...  p 
) [inline]

Definition at line 456 of file lua.h.

References pcall_nopop().

template<typename R , typename... P>
R 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().

template<typename I >
void 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 _lua_init_global_environment_ref(), and ServletRunner::ServletRunner().

void push_value ( lua_State *  state,
const bool  value 
) [inline]
void push_value ( lua_State *  state,
const int  value 
) [inline]

Definition at line 77 of file lua.h.

void push_value ( lua_State *  state,
const lua_Number  value 
) [inline]

Definition at line 81 of file lua.h.

void push_value ( lua_State *  state,
const char *  value 
) [inline]

Definition at line 85 of file lua.h.

void push_value ( lua_State *  state,
const string value 
) [inline]

Definition at line 89 of file lua.h.

void push_value ( lua_State *  state,
void *  value 
) [inline]

Definition at line 93 of file lua.h.

void push_value ( lua_State *  state,
const void *  value 
) [inline]

Definition at line 97 of file lua.h.

void push_values ( lua_State *  ) [inline]

Definition at line 102 of file lua.h.

Referenced by pcall_nopop(), and push_values().

template<typename P >
void push_values ( lua_State *  state,
const P &  p 
) [inline]

Definition at line 105 of file lua.h.

References push_value().

template<typename T , typename... P>
void 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().

template<typename V >
void set_field ( lua_State *  state,
int  index,
const V &  value,
const char *const  field 
) [inline]
template<typename V >
void 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().

template<typename V >
void set_field ( lua_State *  state,
int  index,
const V &  value,
int  n 
) [inline]

Definition at line 133 of file lua.h.

References push_value().

template<typename V , typename... P>
void 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().

template<typename V >
void 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().

template<typename V >
void set_global ( lua_State *  state,
const V &  value,
const string field 
) [inline]

Definition at line 214 of file lua.h.

References push_value().

template<typename V >
void 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 Relay::finish_post(), and Renderer::render_and_cache().

template<typename V >
void set_value ( lua_State *  state,
const V &  value,
const string var 
) [inline]

Definition at line 397 of file lua.h.

References set_global().

template<typename V , typename... P>
void set_value ( lua_State *  state,
const V &  value,
const char *const  var,
P...  p 
) [inline]

Definition at line 402 of file lua.h.

References detail::_set_value(), and get_global().


Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.