ReFRACtor
|
This is a light wrapper around the lua_state object. More...
#include <lua_state.h>
Public Member Functions | |
LuaState (const std::string &Dir_name="./") | |
Create a new instance of Lua. More... | |
virtual | ~LuaState () |
const std::string & | base_dir_name () const |
Base directory that we use when running Lua. More... | |
void | do_file (const std::string &Fname) |
Load the given file and execute it. More... | |
LuabindObject | globals () |
Globals table. More... | |
lua_State * | lua_state () |
Lua state pointer. More... | |
void | print (std::ostream &Os) const |
std::string | print_to_string () const |
Print to string. More... | |
LuabindObject | registry () |
Registery table. More... | |
void | run (const std::string &S) |
Run the given Lua code. More... | |
Static Public Member Functions | |
static boost::shared_ptr< LuaState > | load_file (const std::string &Fname) |
Create a new LuaState, and then open the given file. More... | |
This is a light wrapper around the lua_state object.
This maintains the lifetime of this object, as well as other house keeping chores.
Definition at line 25 of file lua_state.h.
LuaState::LuaState | ( | const std::string & | Dir_name = "./" | ) |
Create a new instance of Lua.
Because it is often convenient to do so, you can optionally give a directory that the we will change to before running Lua code. This allows things like configuration file to use relative paths from where the configuration file is located rather than where we are running from.
Definition at line 70 of file lua_state.cc.
|
inlinevirtual |
Definition at line 28 of file lua_state.h.
|
inline |
Base directory that we use when running Lua.
Definition at line 41 of file lua_state.h.
void LuaState::do_file | ( | const std::string & | Fname | ) |
Load the given file and execute it.
Definition at line 90 of file lua_state.cc.
LuabindObject LuaState::globals | ( | ) |
Globals table.
Definition at line 12 of file lua_state.cc.
|
static |
Create a new LuaState, and then open the given file.
We run this in the same directory as the given file, so for example a configuration file can use relative paths for various files that will be relative to the location of the configuration file, not the directory we happen to be running in.
Definition at line 39 of file lua_state.cc.
|
inline |
Lua state pointer.
You can use this to do things with luabind (or directly with Lua) that this class doesn't already support.
Definition at line 47 of file lua_state.h.
|
inline |
Definition at line 29 of file lua_state.h.
|
inlineinherited |
Print to string.
This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.
Definition at line 31 of file printable.h.
LuabindObject LuaState::registry | ( | ) |
Registery table.
Definition at line 23 of file lua_state.cc.
void LuaState::run | ( | const std::string & | S | ) |
Run the given Lua code.
Definition at line 107 of file lua_state.cc.