NuriaProject Framework
0.1
The NuriaProject Framework
|
Stores a C++ object with an associated Nuria::MetaObject. More...
#include <luaobject.hpp>
Public Member Functions | |
LuaObject () | |
LuaObject (const LuaObject &other) | |
~LuaObject () | |
QVariant | copy () const |
bool | isValid () const |
MetaObject * | metaObject () const |
void * | object () const |
LuaObject & | operator= (const LuaObject &other) |
int | reference () const |
LuaRuntime * | runtime () const |
QVariant | toVariant () const |
Static Public Member Functions | |
static LuaObject | fromStructure (void *object, MetaObject *metaObject, LuaRuntime *runtime, bool takeOwnership=false) |
static LuaObject | fromVariant (const QVariant &variant, LuaRuntime *runtime, bool takeOwnership=false) |
Friends | |
class | LuaMetaObjectWrapper |
class | LuaRuntime |
class | LuaStackUtils |
class | LuaValue |
Stores a C++ object with an associated Nuria::MetaObject.
LuaObject encapsulates a Lua "user data" item, exposing a C++ object through Lua's meta table with the help of MetaObject.
All accesses to it from Lua are redirected to the C++ object.
Nuria::LuaObject::LuaObject | ( | ) |
Constructor for a invalid instance.
Nuria::LuaObject::LuaObject | ( | const LuaObject & | other | ) |
Copy constructor.
Nuria::LuaObject::~LuaObject | ( | ) |
Destructor
QVariant Nuria::LuaObject::copy | ( | ) | const |
Like toVariant(), but the referenced object is copied using its copy constructor and the resulting pointer put into a QVariant.
If copy'ing fails, the resulting QVariant is invalid.
|
static |
Creates a object from object which is defiend by metaObject. The resulting LuaObject is bound to runtime.
If takeOwnership is true
, then ownership of object is transferred to the LUA runtime.
|
static |
Creates a object from variant. If conversion is not possible, the resulting LuaObject will be invalid. The resulting LuaObject is bound to runtime.
If variant contains a pointer type and takeOwnership is true
then ownership of the object inside variant is transferred to the LUA runtime.
bool Nuria::LuaObject::isValid | ( | ) | const |
Returns true
if this instance is valid.
MetaObject* Nuria::LuaObject::metaObject | ( | ) | const |
Returns the associated MetaObject.
void* Nuria::LuaObject::object | ( | ) | const |
Returns the wrapped C++ structure. Returns nullptr
if there's no associated object.
int Nuria::LuaObject::reference | ( | ) | const |
Returns the internal LUA reference.
LuaRuntime* Nuria::LuaObject::runtime | ( | ) | const |
Returns the associated LuaRuntime.
QVariant Nuria::LuaObject::toVariant | ( | ) | const |