Thrive
Public Member Functions | List of all members
thrive::LuaState Class Reference

RAII class for lua_State data structures. More...

#include <lua_state.h>

Public Member Functions

 LuaState ()
 Constructor. More...
 
 LuaState (const LuaState &)=delete
 Non-copyable.
 
 LuaState (LuaState &&other)
 Move constructor. More...
 
 ~LuaState ()
 Destructor.
 
LuaState & operator= (const LuaState &)=delete
 Non-copyable.
 
LuaState & operator= (LuaState &&other)
 Move-assign operator. More...
 
 operator lua_State * ()
 Implicit cast to lua_State*.
 
bool doFile (const std::string &filename)
 Runs the file in the Lua state. More...
 
bool doString (const std::string &string)
 Runs the chunk in the Lua state. More...
 

Detailed Description

RAII class for lua_State data structures.

Constructor & Destructor Documentation

LuaState::LuaState ( )

Constructor.

Calls luaL_newstate and luaL_openlibs.

LuaState::LuaState ( LuaState &&  other)

Move constructor.

Parameters
other

Member Function Documentation

bool LuaState::doFile ( const std::string &  filename)

Runs the file in the Lua state.

Calls luaL_dofile

Parameters
filenameThe file to load and run
Returns
true if successful, false if there were errors
bool LuaState::doString ( const std::string &  string)

Runs the chunk in the Lua state.

Calls luaL_dostring

Parameters
stringThe script chunk to run
Returns
true if successful, false if there were errors
LuaState & LuaState::operator= ( LuaState &&  other)

Move-assign operator.

Parameters
other
Returns

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