mirror of
https://github.com/openresty/openresty
synced 2024-11-09 18:35:51 +01:00
14 lines
486 B
C
14 lines
486 B
C
|
diff --git a/lua_cjson.c b/lua_cjson.c
|
||
|
index 4b1915a..b46e915 100644
|
||
|
--- a/lua_cjson.c
|
||
|
+++ b/lua_cjson.c
|
||
|
@@ -501,7 +501,7 @@ static int lua_array_length(lua_State *l, json_config_t *cfg)
|
||
|
/* table, startkey */
|
||
|
while (lua_next(l, -2) != 0) {
|
||
|
/* table, key, value */
|
||
|
- if (lua_isnumber(l, -2) &&
|
||
|
+ if (lua_type(l, -2) == LUA_TNUMBER &&
|
||
|
(k = lua_tonumber(l, -2))) {
|
||
|
/* Integer >= 1 ? */
|
||
|
if (floor(k) == k && k >= 1) {
|