OOLua  2.0.1
C++ and Lua binding
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
OOLUA::Script Class Reference

OOLua helper class. More...

#include <oolua_script.h>

Public Member Functions

 Script ()
 Initialises the instance. More...
 
 ~Script ()
 Releases the bound lua_State if it is not NULL.
 
int stack_count ()
 Returns the stack count from the lua_State.
 
 operator lua_State * () const
 Conversion operator so that a Script instance can be passed in place of a lua_State pointer.
 
lua_State *const & state () const
 Sometimes you may want to be explicit. More...
 
void gc ()
 Performs a garbage collection on the state.
 
template<typename T >
void register_class ()
 Helper function. More...
 
template<typename T >
void register_class (T *)
 Helper function. More...
 
template<typename T , typename K , typename V >
void register_class_static (K const &k, V const &v)
 Helper function. More...
 
bool run_file (std::string const &filename)
 Helper function. More...
 
bool load_file (std::string const &filename)
 Helper function. More...
 
bool load_chunk (std::string const &chunk)
 Helper function. More...
 
bool run_chunk (std::string const &chunk)
 Helper function. More...
 
template<typename T >
bool pull (T &t)
 Helper function. More...
 
template<typename T >
bool push (T const &t)
 Helper function. More...
 

Public Attributes

Lua_function call
 

Detailed Description

OOLua helper class.

OOLua is purposely designed not to be dependent on the Script class and therefore passes around its dependency of a lua_State instance. The Script class is only a helper and anything you can do with it can be accomplished by using a Lua_function struct, calling OOLUA namespaced functions or using the Lua C API.

Script provides :

Note
This class is not copy constructible or assignable. To accomplish this a counted reference to the lua_State would need to be maintained.
If you do not want to or can not use this class please see setup_user_lua_state

Constructor & Destructor Documentation

OOLUA::Script::Script ( )

Initialises the instance.

Member Function Documentation

bool OOLUA::Script::load_chunk ( std::string const &  chunk)

Helper function.

See Also
OOLUA::load_chunk
bool OOLUA::Script::load_file ( std::string const &  filename)

Helper function.

See Also
OOLUA::load_file
template<typename T >
bool OOLUA::Script::pull ( T &  t)
inline

Helper function.

See Also
OOLUA::pull
template<typename T >
bool OOLUA::Script::push ( T const &  t)
inline

Helper function.

See Also
OOLUA::push
template<typename T >
void OOLUA::Script::register_class ( )
inline

Helper function.

See Also
OOLUA::register_class
template<typename T >
void OOLUA::Script::register_class ( T *  )
inline

Helper function.

See Also
OOLUA::register_class
template<typename T , typename K , typename V >
void OOLUA::Script::register_class_static ( K const &  k,
V const &  v 
)
inline

Helper function.

See Also
OOLUA::register_class_static
bool OOLUA::Script::run_chunk ( std::string const &  chunk)

Helper function.

See Also
OOLUA::run_chunk
bool OOLUA::Script::run_file ( std::string const &  filename)

Helper function.

See Also
OOLUA::run_file
lua_State* const& OOLUA::Script::state ( ) const
inline

Sometimes you may want to be explicit.

See Also
Script::operator()

Member Data Documentation

Lua_function OOLUA::Script::call

Function object instance which can be used to call Lua functions


The documentation for this class was generated from the following file: