CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lua_class_binding< T > Class Template Referencefinal

#include <th_lua_internal.h>

Public Member Functions

 lua_class_binding ()=delete
 
 lua_class_binding (const lua_class_binding &)=delete
 
 lua_class_binding (lua_class_binding &&)=delete
 
lua_class_bindingoperator= (const lua_class_binding &)=delete
 
lua_class_binding operator= (lua_class_binding &&)=delete
 
 lua_class_binding (const lua_register_state *pState, const char *name, lua_CFunction new_fn, lua_metatable mt)
 
void set_superclass (lua_metatable super_mt)
 
template<typename V >
void add_constant (const char *name, V value)
 
template<typename... Args>
void add_metamethod (lua_CFunction fn, const char *name, Args... args)
 
template<typename... Args>
void add_function (lua_CFunction fn, const char *name, Args... args)
 
 ~lua_class_binding ()
 

Detailed Description

template<typename T>
class lua_class_binding< T >

Create a lua 'class' bound to a C++ class.

This class should be immediately destructed after adding all of it's functions, metamethods and constants to complete the creation of the bind.

Constructor & Destructor Documentation

◆ lua_class_binding() [1/4]

template<typename T >
lua_class_binding< T >::lua_class_binding ( )
delete

◆ lua_class_binding() [2/4]

◆ lua_class_binding() [3/4]

template<typename T >
lua_class_binding< T >::lua_class_binding ( lua_class_binding< T > &&  )
delete

◆ lua_class_binding() [4/4]

template<typename T >
lua_class_binding< T >::lua_class_binding ( const lua_register_state pState,
const char name,
lua_CFunction  new_fn,
lua_metatable  mt 
)
inline

Initiate class bindings for lua.

Parameters
pStateThe lua environment to bind to.
nameThe name to give this lua 'class'.
new_fnThe function to call when a new class is created.
mtThe metatable id for the class

◆ ~lua_class_binding()

template<typename T >
lua_class_binding< T >::~lua_class_binding ( )
inline

Destructor which finalizes the lua binding

Member Function Documentation

◆ add_constant()

template<typename T >
template<typename V >
void lua_class_binding< T >::add_constant ( const char name,
V  value 
)
inline

Add a named constant to the lua interface.

Parameters
name(string literal) Name of the constant.
value(tested with int) Value of the constant.

◆ add_function()

template<typename T >
template<typename... Args>
void lua_class_binding< T >::add_function ( lua_CFunction  fn,
const char name,
Args...  args 
)
inline

Add a C++ function to the lua class.

Parameters
fnThe C++ function.
nameThe name of the function in lua.
argsThe upvalues for the function

◆ add_metamethod()

template<typename T >
template<typename... Args>
void lua_class_binding< T >::add_metamethod ( lua_CFunction  fn,
const char name,
Args...  args 
)
inline

Add a C++ metamethod to the lua class.

Parameters
fnThe C++ function to call.
nameThe name of the metamethod (without the __ prefix).
argsThe upvalues for the function.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ set_superclass()

template<typename T >
void lua_class_binding< T >::set_superclass ( lua_metatable  super_mt)
inline

Set another class as the superclass of this class.

Parameters
super_mtThe metatable id of the super class.

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