Luwra
Minimal-overhead Lua wrapper for C++
Public Member Functions | Public Attributes | List of all members
luwra::RefLifecycle Struct Reference

Lifecycle of a reference. More...

#include <reference.hpp>

Public Member Functions

void push () const
 Push the value inside the reference cell onto the originating Lua stack.
 
void push (State *target) const
 Push the value inside the reference cell onto the given Lua stack.
 
 RefLifecycle (const RefLifecycle &other)
 Create a reference using an existing one. The lifecycles of these references are independent.
 
 RefLifecycle (RefLifecycle &&other)
 Take over an existing reference. The given reference's lifecycle is terminated.
 
 RefLifecycle (State *state)
 Create a reference using the value on top of the stack. Consumes the value.
 
 RefLifecycle (State *state, int index)
 Create a reference to a value on the stack. Does not consume the value.
 
 ~RefLifecycle ()
 

Public Attributes

int ref
 Reference identification.
 
Statestate
 State with the reference registry.
 

Detailed Description

Lifecycle of a reference.

Constructor & Destructor Documentation

◆ RefLifecycle() [1/4]

luwra::RefLifecycle::RefLifecycle ( State state)
inline

Create a reference using the value on top of the stack. Consumes the value.

◆ RefLifecycle() [2/4]

luwra::RefLifecycle::RefLifecycle ( State state,
int  index 
)
inline

Create a reference to a value on the stack. Does not consume the value.

◆ RefLifecycle() [3/4]

luwra::RefLifecycle::RefLifecycle ( const RefLifecycle other)
inline

Create a reference using an existing one. The lifecycles of these references are independent.

◆ RefLifecycle() [4/4]

luwra::RefLifecycle::RefLifecycle ( RefLifecycle &&  other)
inline

Take over an existing reference. The given reference's lifecycle is terminated.

◆ ~RefLifecycle()

luwra::RefLifecycle::~RefLifecycle ( )
inline

Member Function Documentation

◆ push() [1/2]

void luwra::RefLifecycle::push ( ) const
inline

Push the value inside the reference cell onto the originating Lua stack.

◆ push() [2/2]

void luwra::RefLifecycle::push ( State target) const
inline

Push the value inside the reference cell onto the given Lua stack.

Member Data Documentation

◆ ref

int luwra::RefLifecycle::ref

Reference identification.

◆ state

State* luwra::RefLifecycle::state

State with the reference registry.