Public Member Functions | Public Attributes | List of all members
luwra::StateWrapper Struct Reference

Public Member Functions

 StateWrapper (State *state)
 
 StateWrapper ()
 
 ~StateWrapper ()
 
 operator State * ()
 
void loadStandardLibrary ()
 
template<typename V >
getGlobal (const std::string &key) const
 
template<typename V >
void setGlobal (const std::string &key, V value) const
 
GlobalAccessor operator[] (const std::string &key) const
 
template<typename T >
void registerUserType (const std::string &ctor_name, const FieldVector &methods=FieldVector(), const FieldVector &meta_methods=FieldVector())
 
int runString (const std::string &code)
 
int runFile (const std::string &filepath)
 

Public Attributes

Statestate
 
bool close_state
 

Detailed Description

Wrapper for a Lua state

Constructor & Destructor Documentation

luwra::StateWrapper::StateWrapper ( State state)
inline

Operate on a foreign state instance.

luwra::StateWrapper::StateWrapper ( )
inline

Create a new Lua state.

luwra::StateWrapper::~StateWrapper ( )
inline

Member Function Documentation

template<typename V >
V luwra::StateWrapper::getGlobal ( const std::string &  key) const
inline

Retrieve a global value.

void luwra::StateWrapper::loadStandardLibrary ( )
inline
luwra::StateWrapper::operator State * ( )
inline
GlobalAccessor luwra::StateWrapper::operator[] ( const std::string &  key) const
inline

Create an accessor to a global value.

template<typename T >
void luwra::StateWrapper::registerUserType ( const std::string &  ctor_name,
const FieldVector methods = FieldVector(),
const FieldVector meta_methods = FieldVector() 
)
inline
int luwra::StateWrapper::runFile ( const std::string &  filepath)
inline

Execute a file.

int luwra::StateWrapper::runString ( const std::string &  code)
inline

Execute a piece of code.

template<typename V >
void luwra::StateWrapper::setGlobal ( const std::string &  key,
value 
) const
inline

Assign a global value.

Member Data Documentation

bool luwra::StateWrapper::close_state
State* luwra::StateWrapper::state