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

Public Member Functions

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

Public Attributes

Reference ref
 Internal reference to the Lua value. More...
 

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

§ Function() [2/3]

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

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