lua-users home
lua-l archive

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


I released version 1.2.4 of a JSON module.  This version addresses a small but important detail when using Lua 5.3:

When a JSON number is decoded, it checks if the number contains a decimal dot. If that is the case, a floating point number will be pushed on the Lua stack, if no dot is contained, an integer is pushed.

Find it at https://github.com/arcapos/luajson/

To illustrate the issue:

-- Before the fix:

Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> json = require 'json'
> = json.decode('42')
42.0
> return  json.decode('42.1')
42.1
> 

-- After the fix

Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> json = require 'json'
> = json.decode('42')
42
> return  json.decode('42.0')
42.0