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

Gateway to the raw C state of Lua. More...

`#include <c_gate.hpp>`

Collaboration diagram for lutok::state_c_gate:
[legend]

## Public Member Functions

| state_c_gate (state &)
| Creates a new gateway to an existing C++ Lua state.
| ~state_c_gate (void)
| Destructor.
lua_State * | c_state (void)
| Returns the C native Lua state.

## Static Public Member Functions

static state | connect (lua_State *)
| Creates a C++ state for a C Lua state.

## Private Attributes

state & | _state
| The C++ state that this class wraps.

## Detailed Description

Gateway to the raw C state of Lua.

This class provides a mechanism to muck with the internals of the state wrapper class. Client code may wish to do so if Lutok is missing some features of the performance of Lutok in a particular situation is not reasonable.

Warning
  The use of this class is discouraged. By using this class, you are entering the world of unsafety. Anything you do through the objects exposed through this class will not be controlled by RAII patterns not validated in any other way, so you can end up corrupting the Lua state and later get crashes on otherwise perfectly-valid C++ code.

## Constructor & Destructor Documentation

## state_c_gate()

lutok::state_c_gate::state_c_gate | ( | state & | state_ | ) |

Creates a new gateway to an existing C++ Lua state.

Parameters

  state_ | The state to connect to. This object must remain alive while the newly-constructed state_c_gate is alive.

## ~state_c_gate()

lutok::state_c_gate::~state_c_gate | ( | void |  | ) |

Destructor.

Destroying this object has no implications on the life cycle of the Lua state. Only the corresponding state object controls when the Lua state is closed.

## Member Function Documentation

## c_state()

lua_State * lutok::state_c_gate::c_state | ( | void |  | ) |

Returns the C native Lua state.

Returns
  A native lua_State object holding the Lua C API state.

## connect()

lutok::state lutok::state_c_gate::connect | ( | lua_State * | raw_state | ) |

static

Creates a C++ state for a C Lua state.

Warning
  The created state object does NOT own the C state. You must take care to properly destroy the input lua_State when you are done with it to not leak resources.

Parameters

  raw_state | The raw state to wrap temporarily.

Returns
  The wrapped state without strong ownership on the input state.

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

- c_gate.hpp
- c_gate.cpp