Lua/LuaInstance: Add move constructor/operator
Former-commit-id: 8d5b28036983597b7b0fc324aa3795d25a9719b8 [formerly f4b8d4e3a69c0af27d909d9efd75b6480ab10126] [formerly f4574b549cc7645cdabb6d2aacb630090648753c [formerly 3ea26bacc97d0e3bd3ca69aabd29f243d07fb869]] Former-commit-id: 40f99457abbf7ed6a24760c2e62e3750d7866315 [formerly 6b881febbb5a07ab25b3e5e3580f9b8717a454d7] Former-commit-id: a5d8a7c3f8731c4dd9d3b059ebf04cd1598dacc7
This commit is contained in:
parent
c1835575c6
commit
303fe658cf
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
public:
|
public:
|
||||||
LuaInstance();
|
LuaInstance();
|
||||||
LuaInstance(const LuaInstance&) = delete;
|
LuaInstance(const LuaInstance&) = delete;
|
||||||
LuaInstance(LuaInstance&&) = delete; ///TODO
|
inline LuaInstance(LuaInstance&& instance) noexcept;
|
||||||
~LuaInstance();
|
~LuaInstance();
|
||||||
|
|
||||||
void ArgCheck(bool condition, unsigned int argNum, const char* error);
|
void ArgCheck(bool condition, unsigned int argNum, const char* error);
|
||||||
|
|
@ -172,7 +172,7 @@ namespace Nz
|
||||||
void* ToUserdata(int index, const String& tname) const;
|
void* ToUserdata(int index, const String& tname) const;
|
||||||
|
|
||||||
LuaInstance& operator=(const LuaInstance&) = delete;
|
LuaInstance& operator=(const LuaInstance&) = delete;
|
||||||
LuaInstance& operator=(LuaInstance&&) = delete; ///TODO
|
inline LuaInstance& operator=(LuaInstance&& instance) noexcept;
|
||||||
|
|
||||||
static int GetIndexOfUpValue(int upValue);
|
static int GetIndexOfUpValue(int upValue);
|
||||||
static LuaInstance* GetInstance(lua_State* state);
|
static LuaInstance* GetInstance(lua_State* state);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,33 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
inline LuaInstance::LuaInstance(LuaInstance&& instance) noexcept :
|
||||||
|
m_memoryLimit(instance.m_memoryLimit),
|
||||||
|
m_memoryUsage(instance.m_memoryUsage),
|
||||||
|
m_timeLimit(m_timeLimit),
|
||||||
|
m_clock(std::move(m_clock)),
|
||||||
|
m_lastError(std::move(m_lastError)),
|
||||||
|
m_state(m_state),
|
||||||
|
m_level(m_level)
|
||||||
|
{
|
||||||
|
instance.m_state = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline LuaInstance& LuaInstance::operator=(LuaInstance&& instance) noexcept
|
||||||
|
{
|
||||||
|
m_clock = std::move(m_clock);
|
||||||
|
m_lastError = std::move(m_lastError);
|
||||||
|
m_level = m_level;
|
||||||
|
m_memoryLimit = instance.m_memoryLimit;
|
||||||
|
m_memoryUsage = instance.m_memoryUsage;
|
||||||
|
m_state = m_state;
|
||||||
|
m_timeLimit = m_timeLimit;
|
||||||
|
|
||||||
|
instance.m_state = nullptr;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// Functions args
|
// Functions args
|
||||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, bool* arg, TypeTag<bool>)
|
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, bool* arg, TypeTag<bool>)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue