Types.h File Reference

Generic functions to deal with custom lua types. More...

Detailed Description

Generic functions to deal with custom lua types.

Definition in file Types.h.

#include <momemta/any.h>
#include <string>
Include dependency graph for Types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void push_type_metatable (lua_State *L, const char *name)
 Push a new metatable on the stack. More...
 
std::string get_custom_type_name (lua_State *L, int index)
 Get the type of a custom table. More...
 
momemta::any get_custom_type_ptr (lua_State *L, int index)
 Convert a lua custom table to a momemta::any value. More...
 

Function Documentation

◆ get_custom_type_name()

std::string get_custom_type_name ( lua_State *  L,
int  index 
)

Get the type of a custom table.

Parameters
Lthe lua state
indexthe index on the stack of the custom table
Returns
The type's name

Definition at line 35 of file Types.cc.

Referenced by get_custom_type_ptr().

◆ get_custom_type_ptr()

momemta::any get_custom_type_ptr ( lua_State *  L,
int  index 
)

Convert a lua custom table to a momemta::any value.

Parameters
Lthe lua state
indexthe index on the stack of the custom table to convert
Returns
a momemta::any value encapsulating the custom type

Definition at line 48 of file Types.cc.

Referenced by lua::to_any().

◆ push_type_metatable()

void push_type_metatable ( lua_State *  L,
const char *  name 
)

Push a new metatable on the stack.

The metatable contains one additional field, __type, describing of which type is the table associated to this metatable

Parameters
Lthe lua state
namethe type's name

Definition at line 26 of file Types.cc.

Referenced by lua::path_register().