Lutok  0.4
 All Classes Namespaces Files Functions Variables Macros
Public Member Functions | Static Public Member Functions | Private Attributes
lutok::state_c_gate Class Reference

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

#include <c_gate.hpp>

List of all members.

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

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.
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

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.
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_stateThe 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: