Otclient  14/8/2020
LuaObject Class Reference

LuaObject, all script-able classes have it as base. More...

#include <luaobject.h>

Inheritance diagram for LuaObject:
Collaboration diagram for LuaObject:

Public Member Functions

 LuaObject ()
 
virtual ~LuaObject ()
 
template<typename T >
void connectLuaField (const std::string &field, const std::function< T > &f, bool pushFront=false)
 
template<typename... T>
int luaCallLuaField (const std::string &field, const T &... args)
 
template<typename R , typename... T>
callLuaField (const std::string &field, const T &... args)
 
template<typename... T>
void callLuaField (const std::string &field, const T &... args)
 
bool hasLuaField (const std::string &field)
 Returns true if the lua field exists. More...
 
template<typename T >
void setLuaField (const std::string &key, const T &value)
 Sets a field in this lua object. More...
 
template<typename T >
getLuaField (const std::string &key)
 Gets a field from this lua object. More...
 
void releaseLuaFieldsTable ()
 Release fields table reference. More...
 
void luaSetField (const std::string &key)
 Sets a field from this lua object, the value must be on the stack. More...
 
void luaGetField (const std::string &key)
 Gets a field from this lua object, the result is pushed onto the stack. More...
 
void luaGetMetatable ()
 Get object's metatable. More...
 
void luaGetFieldsTable ()
 Gets the table containing all stored fields of this lua object, the result is pushed onto the stack. More...
 
int getUseCount ()
 
std::string getClassName ()
 Returns the derived class name, its the same name used in Lua. More...
 
LuaObjectPtr asLuaObject ()
 
void operator= (const LuaObject &)
 
- Public Member Functions inherited from stdext::shared_object
 shared_object ()
 
virtual ~shared_object ()
 
void add_ref ()
 
void dec_ref ()
 
refcount_t ref_count ()
 
template<typename T >
stdext::shared_object_ptr< T > static_self_cast ()
 
template<typename T >
stdext::shared_object_ptr< T > dynamic_self_cast ()
 
template<typename T >
stdext::shared_object_ptr< T > const_self_cast ()
 

Detailed Description

LuaObject, all script-able classes have it as base.

Definition at line 30 of file luaobject.h.

Constructor & Destructor Documentation

◆ LuaObject()

LuaObject::LuaObject ( )

Definition at line 29 of file luaobject.cpp.

◆ ~LuaObject()

LuaObject::~LuaObject ( )
virtual

Definition at line 34 of file luaobject.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ asLuaObject()

LuaObjectPtr LuaObject::asLuaObject ( )
inline

Definition at line 83 of file luaobject.h.

Here is the caller graph for this function:

◆ callLuaField() [1/2]

template<typename R , typename... T>
R LuaObject::callLuaField ( const std::string &  field,
const T &...  args 
)

Definition at line 172 of file luaobject.h.

Here is the call graph for this function:

◆ callLuaField() [2/2]

template<typename... T>
void LuaObject::callLuaField ( const std::string &  field,
const T &...  args 
)

Definition at line 184 of file luaobject.h.

Here is the call graph for this function:

◆ connectLuaField()

template<typename T >
void LuaObject::connectLuaField ( const std::string &  field,
const std::function< T > &  f,
bool  pushFront = false 
)

Definition at line 101 of file luaobject.h.

Here is the call graph for this function:

◆ getClassName()

std::string LuaObject::getClassName ( )

Returns the derived class name, its the same name used in Lua.

Definition at line 117 of file luaobject.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLuaField()

template<typename T >
T LuaObject::getLuaField ( const std::string &  key)

Gets a field from this lua object.

Definition at line 197 of file luaobject.h.

Here is the call graph for this function:

◆ getUseCount()

int LuaObject::getUseCount ( )

Returns the number of references of this object

Note
each userdata of this object on lua counts as a reference

Definition at line 112 of file luaobject.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasLuaField()

bool LuaObject::hasLuaField ( const std::string &  field)

Returns true if the lua field exists.

Definition at line 42 of file luaobject.cpp.

Here is the call graph for this function:

◆ luaCallLuaField()

template<typename... T>
int LuaObject::luaCallLuaField ( const std::string &  field,
const T &...  args 
)

Calls a function or table of functions stored in a lua field, results are pushed onto the stack, if any lua error occurs, it will be reported to stdout and return 0 results

Returns
the number of results

Definition at line 152 of file luaobject.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ luaGetField()

void LuaObject::luaGetField ( const std::string &  key)

Gets a field from this lua object, the result is pushed onto the stack.

Definition at line 76 of file luaobject.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ luaGetFieldsTable()

void LuaObject::luaGetFieldsTable ( )

Gets the table containing all stored fields of this lua object, the result is pushed onto the stack.

Definition at line 104 of file luaobject.cpp.

Here is the call graph for this function:

◆ luaGetMetatable()

void LuaObject::luaGetMetatable ( )

Get object's metatable.

Definition at line 87 of file luaobject.cpp.

Here is the call graph for this function:

◆ luaSetField()

void LuaObject::luaSetField ( const std::string &  key)

Sets a field from this lua object, the value must be on the stack.

Definition at line 62 of file luaobject.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

void LuaObject::operator= ( const LuaObject )
inline

Definition at line 85 of file luaobject.h.

◆ releaseLuaFieldsTable()

void LuaObject::releaseLuaFieldsTable ( )

Release fields table reference.

Definition at line 54 of file luaobject.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLuaField()

template<typename T >
void LuaObject::setLuaField ( const std::string &  key,
const T &  value 
)

Sets a field in this lua object.

Definition at line 191 of file luaobject.h.

Here is the call graph for this function:

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