Lutok  0.4
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
lutok::api_error Class Reference

Exception for errors raised by the Lua API library. More...

#include <exceptions.hpp>

Inheritance diagram for lutok::api_error:
Inheritance graph
[legend]
Collaboration diagram for lutok::api_error:
Collaboration graph
[legend]

Public Member Functions

 api_error (const std::string &, const std::string &)
 Constructs a new error. More...
 
virtual ~api_error (void) throw ()
 Destructor for the error.
 
const std::string & api_function (void) const
 Gets the name of the Lua API function that caused this error. More...
 
- Public Member Functions inherited from lutok::error
 error (const std::string &)
 Constructs a new error with a plain-text message. More...
 
virtual ~error (void) throw ()
 Destructor for the error.
 

Static Public Member Functions

static api_error from_stack (state &, const std::string &)
 Constructs a new api_error with the message on the top of the Lua stack. More...
 

Private Attributes

std::string _api_function
 Name of the Lua C API function that caused the error.
 

Detailed Description

Exception for errors raised by the Lua API library.

Constructor & Destructor Documentation

◆ api_error()

lutok::api_error::api_error ( const std::string &  api_function_,
const std::string &  message 
)
explicit

Constructs a new error.

Parameters
api_function_The name of the API function that caused the error.
messageThe plain-text error message provided by Lua.

Member Function Documentation

◆ api_function()

const std::string & lutok::api_error::api_function ( void  ) const

Gets the name of the Lua API function that caused this error.

Returns
The name of the function.

◆ from_stack()

lutok::api_error lutok::api_error::from_stack ( state state_,
const std::string &  api_function_ 
)
static

Constructs a new api_error with the message on the top of the Lua stack.

Precondition
There is an error message on the top of the stack.
Postcondition
The error message is popped from the stack.
Parameters
state_The Lua state.
api_function_The name of the Lua API function that caused the error.
Returns
A new api_error with the popped message.

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