Merge remote-tracking branch 'refs/remotes/origin/master' into enet_wip_nothing_to_see_here
This commit is contained in:
commit
715664073a
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
public:
|
public:
|
||||||
LuaInstance();
|
LuaInstance();
|
||||||
LuaInstance(const LuaInstance&) = delete;
|
LuaInstance(const LuaInstance&) = delete;
|
||||||
inline LuaInstance(LuaInstance&& instance) noexcept;
|
LuaInstance(LuaInstance&& instance) noexcept;
|
||||||
~LuaInstance();
|
~LuaInstance();
|
||||||
|
|
||||||
void ArgCheck(bool condition, unsigned int argNum, const char* error) const;
|
void ArgCheck(bool condition, unsigned int argNum, const char* error) const;
|
||||||
|
|
@ -173,7 +173,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;
|
||||||
inline LuaInstance& operator=(LuaInstance&& instance) noexcept;
|
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);
|
||||||
|
|
|
||||||
|
|
@ -14,18 +14,6 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline LuaInstance::LuaInstance(LuaInstance&& instance) noexcept :
|
|
||||||
m_memoryLimit(instance.m_memoryLimit),
|
|
||||||
m_memoryUsage(instance.m_memoryUsage),
|
|
||||||
m_timeLimit(instance.m_timeLimit),
|
|
||||||
m_clock(std::move(instance.m_clock)),
|
|
||||||
m_lastError(std::move(instance.m_lastError)),
|
|
||||||
m_state(instance.m_state),
|
|
||||||
m_level(instance.m_level)
|
|
||||||
{
|
|
||||||
instance.m_state = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline lua_State* LuaInstance::GetInternalState() const
|
inline lua_State* LuaInstance::GetInternalState() const
|
||||||
{
|
{
|
||||||
return m_state;
|
return m_state;
|
||||||
|
|
@ -51,21 +39,6 @@ namespace Nz
|
||||||
return m_timeLimit;
|
return m_timeLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline LuaInstance& LuaInstance::operator=(LuaInstance&& instance) noexcept
|
|
||||||
{
|
|
||||||
m_clock = std::move(instance.m_clock);
|
|
||||||
m_lastError = std::move(instance.m_lastError);
|
|
||||||
m_level = instance.m_level;
|
|
||||||
m_memoryLimit = instance.m_memoryLimit;
|
|
||||||
m_memoryUsage = instance.m_memoryUsage;
|
|
||||||
m_state = instance.m_state;
|
|
||||||
m_timeLimit = instance.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>)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,20 @@ namespace Nz
|
||||||
luaL_openlibs(m_state);
|
luaL_openlibs(m_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LuaInstance::LuaInstance(LuaInstance&& instance) noexcept :
|
||||||
|
m_memoryLimit(instance.m_memoryLimit),
|
||||||
|
m_memoryUsage(instance.m_memoryUsage),
|
||||||
|
m_timeLimit(instance.m_timeLimit),
|
||||||
|
m_clock(std::move(instance.m_clock)),
|
||||||
|
m_lastError(std::move(instance.m_lastError)),
|
||||||
|
m_state(instance.m_state),
|
||||||
|
m_level(instance.m_level)
|
||||||
|
{
|
||||||
|
instance.m_state = nullptr;
|
||||||
|
|
||||||
|
lua_setallocf(m_state, MemoryAllocator, this);
|
||||||
|
}
|
||||||
|
|
||||||
LuaInstance::~LuaInstance()
|
LuaInstance::~LuaInstance()
|
||||||
{
|
{
|
||||||
if (m_state)
|
if (m_state)
|
||||||
|
|
@ -801,6 +815,24 @@ namespace Nz
|
||||||
return luaL_testudata(m_state, index, tname.GetConstBuffer());
|
return luaL_testudata(m_state, index, tname.GetConstBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LuaInstance& LuaInstance::operator=(LuaInstance&& instance) noexcept
|
||||||
|
{
|
||||||
|
m_clock = std::move(instance.m_clock);
|
||||||
|
m_lastError = std::move(instance.m_lastError);
|
||||||
|
m_level = instance.m_level;
|
||||||
|
m_memoryLimit = instance.m_memoryLimit;
|
||||||
|
m_memoryUsage = instance.m_memoryUsage;
|
||||||
|
m_state = instance.m_state;
|
||||||
|
m_timeLimit = instance.m_timeLimit;
|
||||||
|
|
||||||
|
instance.m_state = nullptr;
|
||||||
|
|
||||||
|
// Update allocator pointer
|
||||||
|
lua_setallocf(m_state, MemoryAllocator, this);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
int LuaInstance::GetIndexOfUpValue(int upValue)
|
int LuaInstance::GetIndexOfUpValue(int upValue)
|
||||||
{
|
{
|
||||||
return lua_upvalueindex(upValue);
|
return lua_upvalueindex(upValue);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue