webmcp
changeset 463:43a4b74b5b18
Bugfix in JSON library: length of array is an integer, not a float (Lua 5.3 distinguishes them)
author | jbe |
---|---|
date | Sat Sep 10 21:34:59 2016 +0200 (2016-09-10) |
parents | b9bae84cc7a9 |
children | 675a9d645a76 |
files | libraries/json/json.c |
line diff
1.1 --- a/libraries/json/json.c Sat Sep 10 21:24:30 2016 +0200 1.2 +++ b/libraries/json/json.c Sat Sep 10 21:34:59 2016 +0200 1.3 @@ -877,7 +877,11 @@ 1.4 // pop nil from stack if no shadow table has been found: 1.5 if (lua_isnil(L, -1)) lua_pop(L, 1); 1.6 // return length of argument or shadow table: 1.7 +#if LUA_VERSION_NUM >= 503 1.8 + lua_pushinteger(L, lua_rawlen(L, -1)); 1.9 +#else 1.10 lua_pushnumber(L, lua_rawlen(L, -1)); 1.11 +#endif 1.12 return 1; 1.13 } 1.14