Luwra
Minimal-overhead Lua wrapper for C++
Public Member Functions | Public Attributes | List of all members
luwra::Function< Ret > Struct Template Reference

A callable Lua value. More...

#include <function.hpp>

Public Member Functions

template<typename OtherRet >
 Function (const Function< OtherRet > &other)
 Convert from an existing Function.
 
 Function (const Reference &ref)
 Create using a Reference.
 
 Function (State *state, int index)
 Create using a Callable on the stack.
 
Ret operator() () const
 Invoke the callable without arguments.
 
template<typename... Args>
Ret operator() (Args &&... args) const
 Invoke the callable with arguments.
 

Public Attributes

Reference ref
 Internal reference to the Lua value.
 

Detailed Description

template<typename Ret>
struct luwra::Function< Ret >

A callable Lua value.

Template Parameters
RetExpected return type

Constructor & Destructor Documentation

◆ Function() [1/3]

template<typename Ret >
luwra::Function< Ret >::Function ( const Reference ref)
inline

Create using a Reference.

◆ Function() [2/3]

template<typename Ret >
luwra::Function< Ret >::Function ( State state,
int  index 
)
inline

Create using a Callable on the stack.

◆ Function() [3/3]

template<typename Ret >
template<typename OtherRet >
luwra::Function< Ret >::Function ( const Function< OtherRet > &  other)
inline

Convert from an existing Function.

Member Function Documentation

◆ operator()() [1/2]

template<typename Ret >
Ret luwra::Function< Ret >::operator() ( ) const
inline

Invoke the callable without arguments.

◆ operator()() [2/2]

template<typename Ret >
template<typename... Args>
Ret luwra::Function< Ret >::operator() ( Args &&...  args) const
inline

Invoke the callable with arguments.

Member Data Documentation

◆ ref

template<typename Ret >
Reference luwra::Function< Ret >::ref

Internal reference to the Lua value.