Loading...
Searching...
No Matches
lutok::debug Class Reference

A model for the Lua debug state. More...

`#include <debug.hpp>`

Collaboration diagram for lutok::debug:
[legend]

## Classes

struct | impl
| Internal implementation for lutok::debug. More...

## Public Member Functions

| debug (void)
| Constructor for an empty debug structure.
| ~debug (void)
| Destructor.
void | get_info (state &, const std::string &)
| Wrapper around lua_getinfo.
void | get_stack (state &, const int)
| Wrapper around lua_getstack.
int | event (void) const
| Accessor for the 'event' field of lua_Debug.
std::string | name (void) const
| Accessor for the 'name' field of lua_Debug.
std::string | name_what (void) const
| Accessor for the 'namewhat' field of lua_Debug.
std::string | what (void) const
| Accessor for the 'what' field of lua_Debug.
std::string | source (void) const
| Accessor for the 'source' field of lua_Debug.
int | current_line (void) const
| Accessor for the 'currentline' field of lua_Debug.
int | n_ups (void) const
| Accessor for the 'nups' field of lua_Debug.
int | line_defined (void) const
| Accessor for the 'linedefined' field of lua_Debug.
int | last_line_defined (void) const
| Accessor for the 'lastlinedefined' field of lua_Debug.
std::string | short_src (void) const
| Accessor for the 'short_src' field of lua_Debug.

## Private Attributes

std::shared_ptr< impl > | _pimpl
| Pointer to the shared internal implementation.

## Detailed Description

A model for the Lua debug state.

This extremely-simple class provides a mechanism to hide the internals of the C native lua_Debug type, exposing its internal fields using friendlier C++ types.

This class also acts as a complement to the state class by exposing any state-related functions as methods of this function. For example, while it might seem that get_info() belongs in state, we expose it from here because its result is really mutating a debug object, not the state object.

## Member Function Documentation

## current_line()

int lutok::debug::current_line | ( | void |  | ) | const

Accessor for the 'currentline' field of lua_Debug.

Returns
  Returns the 'currentline' field of the internal lua_Debug structure.

## event()

int lutok::debug::event | ( | void |  | ) | const

Accessor for the 'event' field of lua_Debug.

Returns
  Returns the 'event' field of the internal lua_Debug structure.

## get_info()

void lutok::debug::get_info | ( | state & | s,
|  | const std::string & | what_ )

Wrapper around lua_getinfo.

Parameters

  s | The Lua state.
  what_ | The second parameter to lua_getinfo.

Warning
  Terminates execution if there is not enough memory to manipulate the Lua stack.

## get_stack()

void lutok::debug::get_stack | ( | state & | s,
|  | const int | level )

Wrapper around lua_getstack.

Parameters

  s | The Lua state.
  level | The second parameter to lua_getstack.

## last_line_defined()

int lutok::debug::last_line_defined | ( | void |  | ) | const

Accessor for the 'lastlinedefined' field of lua_Debug.

Returns
  Returns the 'lastlinedefined' field of the internal lua_Debug structure.

## line_defined()

int lutok::debug::line_defined | ( | void |  | ) | const

Accessor for the 'linedefined' field of lua_Debug.

Returns
  Returns the 'linedefined' field of the internal lua_Debug structure.

## n_ups()

int lutok::debug::n_ups | ( | void |  | ) | const

Accessor for the 'nups' field of lua_Debug.

Returns
  Returns the 'nups' field of the internal lua_Debug structure.

## name()

std::string lutok::debug::name | ( | void |  | ) | const

Accessor for the 'name' field of lua_Debug.

Returns
  Returns the 'name' field of the internal lua_Debug structure.

## name_what()

std::string lutok::debug::name_what | ( | void |  | ) | const

Accessor for the 'namewhat' field of lua_Debug.

Returns
  Returns the 'namewhat' field of the internal lua_Debug structure.

## short_src()

std::string lutok::debug::short_src | ( | void |  | ) | const

Accessor for the 'short_src' field of lua_Debug.

Returns
  Returns the 'short_src' field of the internal lua_Debug structure.

## source()

std::string lutok::debug::source | ( | void |  | ) | const

Accessor for the 'source' field of lua_Debug.

Returns
  Returns the 'source' field of the internal lua_Debug structure.

## what()

std::string lutok::debug::what | ( | void |  | ) | const

Accessor for the 'what' field of lua_Debug.

Returns
  Returns the 'what' field of the internal lua_Debug structure.

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

- debug.hpp
- debug.cpp