Lua/LuaInstance: Add move constructor/operator
Former-commit-id: 269dae9bec070b32c13ccfe206a9952ce4fe72d4 [formerly 0e7d285bfa29137724f395c2fcdfa3b9b34f47ba] [formerly 7301944fc18b0fb00c731c35a395359a12250aa5 [formerly 580622587a38bf7d14b215061c0371997bb22dc1]] Former-commit-id: 1af27d8ee779851974cb5a6b5e9ebbd18df56afb [formerly dae4bd81771043dea92460a6431550dec214949d] Former-commit-id: 0722749673de04fd3c9f3bafd7287fa82ef01b94
This commit is contained in:
parent
5639422e07
commit
a3e9a303b6
|
|
@ -31,7 +31,7 @@ namespace Nz
|
|||
public:
|
||||
LuaInstance();
|
||||
LuaInstance(const LuaInstance&) = delete;
|
||||
LuaInstance(LuaInstance&&) = delete; ///TODO
|
||||
inline LuaInstance(LuaInstance&& instance) noexcept;
|
||||
~LuaInstance();
|
||||
|
||||
void ArgCheck(bool condition, unsigned int argNum, const char* error);
|
||||
|
|
@ -172,7 +172,7 @@ namespace Nz
|
|||
void* ToUserdata(int index, const String& tname) const;
|
||||
|
||||
LuaInstance& operator=(const LuaInstance&) = delete;
|
||||
LuaInstance& operator=(LuaInstance&&) = delete; ///TODO
|
||||
inline LuaInstance& operator=(LuaInstance&& instance) noexcept;
|
||||
|
||||
static int GetIndexOfUpValue(int upValue);
|
||||
static LuaInstance* GetInstance(lua_State* state);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,33 @@
|
|||
|
||||
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
|
||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, bool* arg, TypeTag<bool>)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue