lua::LazyFunction Struct Reference

Lazy function in lua (delayed function evaluation) More...

#include <utils.h>

Detailed Description

Lazy function in lua (delayed function evaluation)

It's just a small wrapper around a lua anonymous function.

Definition at line 72 of file utils.h.

Inheritance diagram for lua::LazyFunction:

Public Member Functions

virtual momemta::any operator() () const override
 Evaluate the anonymous function. More...
 
 LazyFunction (lua_State *L, int index)
 Bind a anonymous lua function. More...
 
- Public Member Functions inherited from lua::Lazy
 Lazy (lua_State *L)
 

Public Attributes

int ref_index
 The reference index where the anonymous function is stored.
 
- Public Attributes inherited from lua::Lazy
lua_State * L
 The global lua state. This state must be valid for as long as this instance.
 

Constructor & Destructor Documentation

◆ LazyFunction()

lua::LazyFunction::LazyFunction ( lua_State *  L,
int  index 
)

Bind a anonymous lua function.

Parameters
LThe current lua state.
indexThe index of the anonymous function on the stack

Definition at line 45 of file utils.cc.

Referenced by lua::to_any().

Member Function Documentation

◆ operator()()

momemta::any lua::LazyFunction::operator() ( ) const
overridevirtual

Evaluate the anonymous function.

Returns
The return value of the anonymous function

Implements lua::Lazy.

Definition at line 55 of file utils.cc.


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