Lua/LuaInstance: Improve code

Former-commit-id: fa50a5a8610ac3f9c91392cf3eda8ea2ece2fadb [formerly 79dca34081cf9590ee906053bec751337a9a6dfd] [formerly c57fc5a5e10d531d14bcff891a9e9621db26a2b5 [formerly d3694fd32c07d74029120427321eb96815625fcd]]
Former-commit-id: c3b064cf106b0ad7929b7b2267b1580ea41bcaf6 [formerly a309b75b7d85d22a9866b4c6bf0be39a6ce34ad6]
Former-commit-id: 46ac5dd063eb4c05ac5fb7cc6fa414c02e2ed43d
This commit is contained in:
Lynix
2016-09-04 19:58:22 +02:00
parent 1ef0c04f20
commit 2b27ba35c3
3 changed files with 35 additions and 34 deletions

View File

@@ -464,26 +464,6 @@ namespace Nz
return FromLuaType(lua_getglobal(m_state, name.GetConstBuffer()));
}
lua_State* LuaInstance::GetInternalState() const
{
return m_state;
}
String LuaInstance::GetLastError() const
{
return m_lastError;
}
UInt32 LuaInstance::GetMemoryLimit() const
{
return m_memoryLimit;
}
UInt32 LuaInstance::GetMemoryUsage() const
{
return m_memoryUsage;
}
LuaType LuaInstance::GetMetatable(const char* tname) const
{
return FromLuaType(luaL_getmetatable(m_state, tname));
@@ -501,7 +481,7 @@ namespace Nz
unsigned int LuaInstance::GetStackTop() const
{
return lua_gettop(m_state);
return static_cast<int>(lua_gettop(m_state));
}
LuaType LuaInstance::GetTable(int index) const
@@ -509,11 +489,6 @@ namespace Nz
return FromLuaType(lua_gettable(m_state, index));
}
UInt32 LuaInstance::GetTimeLimit() const
{
return m_timeLimit;
}
LuaType LuaInstance::GetType(int index) const
{
return FromLuaType(lua_type(m_state, index));
@@ -690,9 +665,10 @@ namespace Nz
lua_pushlstring(m_state, str.GetConstBuffer(), str.GetSize());
}
void LuaInstance::PushTable(unsigned int sequenceElementCount, unsigned int arrayElementCount) const
void LuaInstance::PushTable(std::size_t sequenceElementCount, std::size_t arrayElementCount) const
{
lua_createtable(m_state, sequenceElementCount, arrayElementCount);
constexpr std::size_t maxInt = std::numeric_limits<int>::max();
lua_createtable(m_state, static_cast<int>(std::min(sequenceElementCount, maxInt)), static_cast<int>(std::min(arrayElementCount, maxInt)));
}
void* LuaInstance::PushUserdata(std::size_t size) const