mirror of https://github.com/openresty/openresty
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
486 B
Diff
14 lines
486 B
Diff
13 years ago
|
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) {
|