ponder 3.2
C++ reflection library
ponder::lua Namespace Reference

Contains Ponder Lua support public API. More...

Functions

void expose (lua_State *L, const Class &cls, const IdRef exposeName)
 Expose a single Ponder metaclass to a Lua state. More...
 
void expose (lua_State *L, const Enum &e, const IdRef exposeName)
 Expose a single Ponder enumeration to a Lua state. More...
 
template<typename T >
void expose (lua_State *L, const IdRef exposeName)
 Expose a single Ponder type to a Lua state. More...
 
int pushUserObject (lua_State *L, const UserObject &uobj)
 Push a copy of a UserObject onto the Lua stack. More...
 
bool runString (lua_State *L, const char *luaCode)
 Expose all existing Ponder registered objects to a Lua state. More...
 

Detailed Description

Contains Ponder Lua support public API.

You can automatically generate Lua bindings for your declared API.

Function Documentation

◆ expose() [1/3]

void ponder::lua::expose ( lua_State *  L,
const Class cls,
const IdRef  exposeName 
)

Expose a single Ponder metaclass to a Lua state.

Parameters
LLua state in which to expose the class.
clsMetaclass instance in Ponder.
exposeNameThe name of the class in the Lua state.

◆ expose() [2/3]

void ponder::lua::expose ( lua_State *  L,
const Enum e,
const IdRef  exposeName 
)

Expose a single Ponder enumeration to a Lua state.

Parameters
LLua state in which to expose the class.
eEnum instance in Ponder.
exposeNameThe name of the class in the Lua state.

◆ expose() [3/3]

template<typename T >
void ponder::lua::expose ( lua_State *  L,
const IdRef  exposeName 
)

Expose a single Ponder type to a Lua state.

Parameters
TType to expose. Can be a class or enumeration.
LLua state in which to expose the class.
exposeNameThe name of the class in the Lua state.

◆ pushUserObject()

int ponder::lua::pushUserObject ( lua_State *  L,
const UserObject uobj 
)

Push a copy of a UserObject onto the Lua stack.

You choose whether to copy or reference an object. E.g.

pushUserObject(L, val.cref<UserObject>()); // reference
pushUserObject(L, val.to<UserObject>()); // copy
Parameters
LLua state to use.
uobjThe UserObject to copy.
Returns
Number of items pushed onto the Lua stack

◆ runString()

bool ponder::lua::runString ( lua_State *  L,
const char *  luaCode 
)

Expose all existing Ponder registered objects to a Lua state.

Parameters
LLua state in which to expose the objects.
ponder::lua::pushUserObject
int pushUserObject(lua_State *L, const UserObject &uobj)
Push a copy of a UserObject onto the Lua stack.