Otclient
14/8/2020
|
LuaObject, all script-able classes have it as base. More...
#include <luaobject.h>
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> | |
R | 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 > | |
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 () |
LuaObject, all script-able classes have it as base.
Definition at line 30 of file luaobject.h.
LuaObject::LuaObject | ( | ) |
Definition at line 29 of file luaobject.cpp.
|
virtual |
|
inline |
R LuaObject::callLuaField | ( | const std::string & | field, |
const T &... | args | ||
) |
void LuaObject::callLuaField | ( | const std::string & | field, |
const T &... | args | ||
) |
void LuaObject::connectLuaField | ( | const std::string & | field, |
const std::function< T > & | f, | ||
bool | pushFront = false |
||
) |
std::string LuaObject::getClassName | ( | ) |
Returns the derived class name, its the same name used in Lua.
Definition at line 117 of file luaobject.cpp.
T LuaObject::getLuaField | ( | const std::string & | key | ) |
Gets a field from this lua object.
Definition at line 197 of file luaobject.h.
int LuaObject::getUseCount | ( | ) |
Returns the number of references of this object
Definition at line 112 of file luaobject.cpp.
bool LuaObject::hasLuaField | ( | const std::string & | field | ) |
Returns true if the lua field exists.
Definition at line 42 of file luaobject.cpp.
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
Definition at line 152 of file luaobject.h.
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.
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.
void LuaObject::luaGetMetatable | ( | ) |
Get object's metatable.
Definition at line 87 of file luaobject.cpp.
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.
|
inline |
Definition at line 85 of file luaobject.h.
void LuaObject::releaseLuaFieldsTable | ( | ) |
Release fields table reference.
Definition at line 54 of file luaobject.cpp.
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.