changes in number conversion
This commit is contained in:
parent
132f9a00e4
commit
b0f8e495c9
|
@ -79,7 +79,6 @@ end
|
|||
|
||||
local oldtonumber = tonumber
|
||||
function tonumber(v)
|
||||
local v = oldtonumber(v)
|
||||
if not v then return 0 end
|
||||
return v
|
||||
if v == nil then return 0 end
|
||||
return oldtonumber(v)
|
||||
end
|
||||
|
|
|
@ -45,8 +45,8 @@ void push_luavalue(int i)
|
|||
bool luavalue_cast(int index, int& i)
|
||||
{
|
||||
i = g_lua.toInteger(index);
|
||||
//if(i == 0 && !g_lua.isNumber(index))
|
||||
// return false;
|
||||
if(i == 0 && !g_lua.isNumber(index) && !g_lua.isNil())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,8 @@ void push_luavalue(double d)
|
|||
bool luavalue_cast(int index, double& d)
|
||||
{
|
||||
d = g_lua.toNumber(index);
|
||||
//if(d == 0 && !g_lua.isNumber(index))
|
||||
// return false;
|
||||
if(d == 0 && !g_lua.isNumber(index) && !g_lua.isNil())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue