Lua Utils
Biblioteca utilitária para facilitar a integração de Lua com C++
Public Member Functions | List of all members
LuaProxy::Base Class Referenceabstract

#include <luaProxy.h>

Inheritance diagram for LuaProxy::Base:
Inheritance graph
[legend]

Public Member Functions

virtual void * getClassMetatableID ()=0
 
virtual void populateMetatable (lua_State *L, int index)=0
 

Detailed Description

Objects may derive from this interface to indicate that they are capable of being added to and manipulated by a Lua state.

Member Function Documentation

◆ getClassMetatableID()

virtual void* LuaProxy::Base::getClassMetatableID ( )
pure virtual

A scriptable object should return here a unique ID for its class. This will be used to identify the class's metatable once it has been created.

Warning
Objects of the same most-derived class must return the same ID! Objects of different most-derived classes must return different IDs!

Implemented in LuaSimplePtrProxy< T >, and LuaSimpleProxy< T >.

◆ populateMetatable()

virtual void LuaProxy::Base::populateMetatable ( lua_State *  L,
int  index 
)
pure virtual

The value at index in the Lua stack is guaranteed to be a table (which may or may not be empty; see below). This method must fill it with events/metamethods (set functions and tables in the table using strings as keys) so that userdata representing objects of this class will behave appropriately.

For convenience, the metatable will already have an "__index" event set to an empty table, so you can start filling that out immediately.

Hint: Design your classes so that the first thing in the method's body being an invocation of __super::populateMetatable() ensures proper inheritance.

Implemented in LuaSimpleTypedPtrProxy< T, typeName >, LuaSimplePtrProxy< T >, and LuaSimpleProxy< T >.


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