lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 30.05.2012 0:53, Dirk Laurie wrote:
Yes. You need to create a global variable called "inf".
Then standard Lua (5.1 and 5.2) can do it.
----
loadstring = loadstring or load
inf = math.huge

function testinf()
    local s=tostring(math.huge)
    local f= loadstring("return "..s)
    return f()
end

print(1/testinf()) -->  true
print( testinf()==inf) -->true
----


It won't work. tostring(math.huge) = "1.#INF" in VS.

P.S. BTW, NANs need very special treatment as they can't be used as table keys.

--
Best regards,
Sergey Rozhenko                 mailto:sergroj@mail.ru