lua-users home
lua-l archive

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




-----Message d'origine----- From: Joshua Jensen What about this:

math.isfloat(1)
-> false
math.isfloat(1.0)
-> true

Sent: Saturday, July 06, 2013 5:35 PM To: lua-l@lists.lua.org Subject: Re: [ANN] Lua 5.3.0 (work1) now available
----- Original Message -----
From: Luiz Henrique de Figueiredo
Date: 7/5/2013 8:22 PM
The main change in Lua 5.3.0 is support for integers.

I played around with this a bit. The only thing I found that appears to be missing is the ability to determine the actual type of the number. That is:

    a = 5
    ttype(a) == 'number'

    b = 5.0
    ttype(b) == 'number

From the C API, it appears that lua_isinteger() will work for the 'a' case.

It would be nice if there was a method to do so in Lua itself. One use case is for serializing integer values to disk in text form properly.

Thanks!

Josh