Lua-API++
2015-02-12-3
Lua-API++ library
|
Lua state object. More...
Public Member Functions | |
Life cycle | |
State () | |
Default constructor. | |
State (void *(__cdecl customAllocatorFunction)(void *ud, void *ptr, size_t oldSize, size_t newSize), void *ud=nullptr) | |
Custom allocator constructor. | |
~State () noexcept | |
Destructor frees the associated Lua state. More... | |
State (const State &)=delete | |
State & | operator= (const State &)=delete |
Environment setup | |
void | runFile (const char *filename) |
Execute Lua file (text or bytecode). More... | |
void | runFile (const std::string &filename) |
Execute Lua file (text or bytecode). More... | |
void | runString (const char *expression) |
Execute a string. More... | |
void | runString (const std::string &expression) |
Execute a string. More... | |
void | call (CFunction f) |
Execute C function. More... | |
Direct Lua API interaction | |
lua_State * | getRawState () noexcept |
Access to raw Lua state pointer (for direct use with Lua API). | |
Lua state object.
State object represents a Lua state. Besides state creation and destruction, it can be used for setting up the environment by executing Lua files, C functions or strings.
|
noexcept |
Destructor frees the associated Lua state.
All raw pointers to lua_State are invalidated after object destruction.
void runFile | ( | const char * | filename | ) |
Execute Lua file (text or bytecode).
std::runtime_error | In case of execution error, what() contains additional information. |
|
inline |
Execute Lua file (text or bytecode).
std::runtime_error | In case of execution error, what() contains additional information. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
void runString | ( | const char * | expression | ) |
Execute a string.
std::runtime_error | In case of execution error, what() contains additional information. |
|
inline |
Execute a string.
std::runtime_error | In case of execution error, what() contains additional information. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
void call | ( | CFunction | f | ) |
Execute C function.
std::runtime_error | In case of execution error, what() contains additional information. |