Lua: Fix compilation error with some arguments type

Former-commit-id: 954f5ddff3c7fba4fa5975321f2c6a1c89c3d4ad
This commit is contained in:
Lynix 2015-12-07 19:54:45 +01:00
parent f1166b68a9
commit 4ccbaece88
3 changed files with 15 additions and 8 deletions

View File

@ -133,8 +133,8 @@ namespace Nz
void Remove(int index);
void Replace(int index);
void SetField(const char* name, int index = -2);
void SetField(const String& name, int index = -2);
void SetField(const char* name, int tableIndex = -2);
void SetField(const String& name, int tableIndex = -2);
void SetGlobal(const char* name);
void SetGlobal(const String& name);
void SetMetatable(const char* tname);

View File

@ -137,6 +137,12 @@ namespace Nz
{
}
template<unsigned int N>
void ProcessArgs()
{
// No argument to process
}
template<unsigned int N, typename ArgType>
void ProcessArgs()
{
@ -168,7 +174,7 @@ namespace Nz
}
private:
std::tuple<Args...> m_args;
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> m_args;
LuaInstance& m_instance;
};
@ -185,6 +191,7 @@ namespace Nz
template<unsigned int N>
void ProcessArgs()
{
// No argument to process
}
template<unsigned int N, typename ArgType>
@ -232,7 +239,7 @@ namespace Nz
}
private:
std::tuple<Args...> m_args;
std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...> m_args;
LuaInstance& m_instance;
T& m_object;
};

View File

@ -714,14 +714,14 @@ namespace Nz
lua_replace(m_state, index);
}
void LuaInstance::SetField(const char* name, int index)
void LuaInstance::SetField(const char* name, int tableIndex)
{
lua_setfield(m_state, index, name);
lua_setfield(m_state, tableIndex, name);
}
void LuaInstance::SetField(const String& name, int index)
void LuaInstance::SetField(const String& name, int tableIndex)
{
lua_setfield(m_state, index, name.GetConstBuffer());
lua_setfield(m_state, tableIndex, name.GetConstBuffer());
}
void LuaInstance::SetGlobal(const char* name)