OOLua  2.0.1
C++ and Lua binding
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Error Reporting

Defines how any errors are reported. More...

Modules

 Exception classes
 

Macros

#define OOLUA_USE_EXCEPTIONS
 Default: Disabled More...
 
#define OOLUA_STORE_LAST_ERROR
 Default: Enabled More...
 

Functions

void OOLUA::reset_error_value (lua_State *vm)
 Reset the error state such that a call to OOLUA::get_last_error will return an empty string. More...
 
std::string OOLUA::get_last_error (lua_State *vm)
 Returns the last stored error. More...
 

Detailed Description

Defines how any errors are reported.

Errors can be reported either by using exceptions or storing a retrievable error string. Only one of these methods is allowed and this condition is enforced, yet also neither are required. If both options are disabled then it depends on OOLUA_DEBUG_CHECKS as to whether any error will be reported.

Macro Definition Documentation

#define OOLUA_STORE_LAST_ERROR

Default: Enabled

Stores an error message in the registry which overwrites any previously stored error. The last error to have occurred is retrievable via OOLUA::get_last_error.

See Also
OOLUA::get_last_error
OOLUA::reset_error_value
Parameters
0Disabled
1Enabled
#define OOLUA_USE_EXCEPTIONS

Default: Disabled

Throws exceptions from C++ code. This could be the return of a pcall, or from pulling an incorrect type off the stack when OOLUA_RUNTIME_CHECKS_ENABLED is enabled. It also prevents exceptions escaping from functions proxied by the library, enabling calls to such functions to be caught with pcall in Lua code.

Parameters
0Disabled
1Enabled

Function Documentation

std::string OOLUA::get_last_error ( lua_State vm)

Returns the last stored error.

Returns
empty string if there is not an error else the error message
See Also
Error Reporting
Note
This function is a nop when OOLUA_STORE_LAST_ERROR is not enabled
void OOLUA::reset_error_value ( lua_State vm)

Reset the error state such that a call to OOLUA::get_last_error will return an empty string.

See Also
Error Reporting
Note
This function is a nop when OOLUA_STORE_LAST_ERROR is not enabled