Lua/LuaInstance: Fix warning + optimizations
Former-commit-id: 4191d942ed50058fba0d2a5ed533c41e993fd0eb
This commit is contained in:
parent
32829863aa
commit
d73d935c82
|
|
@ -18,22 +18,28 @@ double NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<
|
||||||
|
|
||||||
float NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<float>)
|
float NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<float>)
|
||||||
{
|
{
|
||||||
return instance.CheckNumber(index);
|
return static_cast<float>(instance.CheckNumber(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
int NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<int>)
|
int NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<int>)
|
||||||
{
|
{
|
||||||
return instance.CheckInteger(index);
|
return static_cast<int>(instance.CheckInteger(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<std::string>)
|
std::string NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<std::string>)
|
||||||
{
|
{
|
||||||
return instance.CheckString(index);
|
std::size_t strLength = 0;
|
||||||
|
const char* str = instance.CheckString(index, &strLength);
|
||||||
|
|
||||||
|
return std::string(str, strLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
NzString NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<NzString>)
|
NzString NzLuaImplQueryArg(NzLuaInstance& instance, unsigned int index, NzTypeTag<NzString>)
|
||||||
{
|
{
|
||||||
return instance.CheckString(index);
|
std::size_t strLength = 0;
|
||||||
|
const char* str = instance.CheckString(index, &strLength);
|
||||||
|
|
||||||
|
return NzString(str, strLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue