Lua/LuaInstance: Expose some raw functions

This commit is contained in:
Jérôme Leclercq 2017-05-29 18:01:31 +02:00
parent 3e97240148
commit 30a4e20ee5
2 changed files with 18 additions and 0 deletions

View File

@ -101,6 +101,7 @@ namespace Nz
bool GetMetatable(int index) const;
unsigned int GetStackTop() const;
LuaType GetTable(int index = -2) const;
LuaType GetTableRaw(int index = -2) const;
inline UInt32 GetTimeLimit() const;
LuaType GetType(int index) const;
const char* GetTypeName(LuaType type) const;
@ -113,6 +114,7 @@ namespace Nz
bool IsValid(int index) const;
long long Length(int index) const;
std::size_t LengthRaw(int index) const;
void MoveTo(LuaInstance* instance, int n) const;
@ -161,6 +163,7 @@ namespace Nz
void SetMetatable(int index) const;
void SetMemoryLimit(std::size_t memoryLimit);
void SetTable(int index = -3) const;
void SetTableRaw(int index = -3) const;
void SetTimeLimit(UInt32 timeLimit);
bool ToBoolean(int index) const;

View File

@ -503,6 +503,11 @@ namespace Nz
return FromLuaType(lua_gettable(m_state, index));
}
LuaType LuaInstance::GetTableRaw(int index) const
{
return FromLuaType(lua_rawget(m_state, index));
}
LuaType LuaInstance::GetType(int index) const
{
return FromLuaType(lua_type(m_state, index));
@ -586,6 +591,11 @@ namespace Nz
return luaL_len(m_state, index);
}
std::size_t LuaInstance::LengthRaw(int index) const
{
return lua_rawlen(m_state, index);
}
void LuaInstance::MoveTo(LuaInstance* instance, int n) const
{
lua_xmove(m_state, instance->m_state, n);
@ -750,6 +760,11 @@ namespace Nz
lua_settable(m_state, index);
}
void LuaInstance::SetTableRaw(int index) const
{
lua_rawset(m_state, index);
}
void LuaInstance::SetTimeLimit(UInt32 timeLimit)
{
if (m_timeLimit != timeLimit)