Lua/LuaClass: Add Reset method and default constructor
This commit is contained in:
@@ -34,6 +34,7 @@ namespace Nz
|
|||||||
using StaticIndexFunc = std::function<bool(LuaInstance& lua)>;
|
using StaticIndexFunc = std::function<bool(LuaInstance& lua)>;
|
||||||
using StaticFunc = std::function<int(LuaInstance& lua)>;
|
using StaticFunc = std::function<int(LuaInstance& lua)>;
|
||||||
|
|
||||||
|
LuaClass() = default;
|
||||||
LuaClass(const String& name);
|
LuaClass(const String& name);
|
||||||
|
|
||||||
void BindDefaultConstructor();
|
void BindDefaultConstructor();
|
||||||
@@ -50,6 +51,9 @@ namespace Nz
|
|||||||
template<class P> void Inherit(LuaClass<P>& parent);
|
template<class P> void Inherit(LuaClass<P>& parent);
|
||||||
template<class P> void Inherit(LuaClass<P>& parent, ConvertToParent<P> convertFunc);
|
template<class P> void Inherit(LuaClass<P>& parent, ConvertToParent<P> convertFunc);
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
void Reset(const String& name);
|
||||||
|
|
||||||
void Register(LuaInstance& lua);
|
void Register(LuaInstance& lua);
|
||||||
|
|
||||||
void PushGlobalTable(LuaInstance& lua);
|
void PushGlobalTable(LuaInstance& lua);
|
||||||
|
|||||||
@@ -10,10 +10,9 @@
|
|||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
template<class T>
|
template<class T>
|
||||||
LuaClass<T>::LuaClass(const String& name) :
|
LuaClass<T>::LuaClass(const String& name)
|
||||||
m_info(new ClassInfo)
|
|
||||||
{
|
{
|
||||||
m_info->name = name;
|
Reset(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -58,6 +57,20 @@ namespace Nz
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void LuaClass<T>::Reset()
|
||||||
|
{
|
||||||
|
m_info.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void LuaClass<T>::Reset(const String& name)
|
||||||
|
{
|
||||||
|
m_info = std::make_shared<ClassInfo>();
|
||||||
|
m_info->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void LuaClass<T>::Register(LuaInstance& lua)
|
void LuaClass<T>::Register(LuaInstance& lua)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user