Skip to content

Commit

Permalink
when decoding json numbers, consider the numeric format
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalmer committed Feb 15, 2016
1 parent b63fe36 commit b577101
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions luajson.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ decode_value(lua_State *L, char **s, int null)
}
*s += 4;
} else if (isdigit(**s) || **s == '+' || **s == '-') {
lua_pushnumber(L, atof(*s));
if (strchr(*s, '.'))
lua_pushnumber(L, atof(*s));
else
lua_pushinteger(L, atol(*s));
/* advance pointer past the number */
while (isdigit(**s) || **s == '+' || **s == '-'
|| **s == 'e' || **s == 'E' || **s == '.')
Expand Down Expand Up @@ -553,7 +556,7 @@ json_set_info(lua_State *L)
lua_pushliteral(L, "JSON encoder/decoder for Lua");
lua_settable(L, -3);
lua_pushliteral(L, "_VERSION");
lua_pushliteral(L, "json 1.2.3");
lua_pushliteral(L, "json 1.2.4");
lua_settable(L, -3);
}

Expand Down

0 comments on commit b577101

Please sign in to comment.