changes in number conversion

This commit is contained in:
Eduardo Bart 2012-01-06 22:52:59 -02:00
parent 132f9a00e4
commit b0f8e495c9
2 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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;
}