Ardour  9.0-pre0-582-g084a23a80d
LuaRef::StackPop Class Reference

Public Member Functions

 StackPop (lua_State *L, int count)
 
 ~StackPop ()
 

Private Attributes

lua_Statem_L
 
int m_count
 

Detailed Description

Pop the Lua stack.

Pops the specified number of stack items on destruction. We use this when returning objects, to avoid an explicit temporary variable, since the destructor executes after the return statement. For example:

template <class U>
{
StackPop p (L, 1);
...
return U (); // dtor called after this line
}
StackPop(lua_State *L, int count)
Definition: LuaRef.h:85
T cast() const
Definition: LuaRef.h:873
Note
The StackPop object must always be a named local variable.

Definition at line 77 of file LuaRef.h.

Constructor & Destructor Documentation

◆ StackPop()

LuaRef::StackPop::StackPop ( lua_State L,
int  count 
)
inline

Create a StackPop object.

Parameters
Lthe LuaState to modify
countThe number of stack entries to pop on destruction.

Definition at line 85 of file LuaRef.h.

◆ ~StackPop()

LuaRef::StackPop::~StackPop ( )
inline

Definition at line 91 of file LuaRef.h.

Member Data Documentation

◆ m_count

int LuaRef::StackPop::m_count
private

Definition at line 98 of file LuaRef.h.

◆ m_L

lua_State* LuaRef::StackPop::m_L
private

Definition at line 97 of file LuaRef.h.


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