diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1043,7 +1043,10 @@ static int table_query (lua_State *L) { | |||
1043 | } | 1043 | } |
1044 | else if (cast_uint(i) < asize) { | 1044 | else if (cast_uint(i) < asize) { |
1045 | lua_pushinteger(L, i); | 1045 | lua_pushinteger(L, i); |
1046 | arr2obj(t, cast_uint(i), s2v(L->top.p)); | 1046 | if (!tagisempty(*getArrTag(t, i))) |
1047 | arr2obj(t, cast_uint(i), s2v(L->top.p)); | ||
1048 | else | ||
1049 | setnilvalue(s2v(L->top.p)); | ||
1047 | api_incr_top(L); | 1050 | api_incr_top(L); |
1048 | lua_pushnil(L); | 1051 | lua_pushnil(L); |
1049 | } | 1052 | } |
@@ -1057,11 +1060,11 @@ static int table_query (lua_State *L) { | |||
1057 | } | 1060 | } |
1058 | else | 1061 | else |
1059 | lua_pushliteral(L, "<undef>"); | 1062 | lua_pushliteral(L, "<undef>"); |
1060 | pushobject(L, gval(gnode(t, i))); | 1063 | if (!isempty(gval(gnode(t, i)))) |
1061 | if (gnext(&t->node[i]) != 0) | 1064 | pushobject(L, gval(gnode(t, i))); |
1062 | lua_pushinteger(L, gnext(&t->node[i])); | ||
1063 | else | 1065 | else |
1064 | lua_pushnil(L); | 1066 | lua_pushnil(L); |
1067 | lua_pushinteger(L, gnext(&t->node[i])); | ||
1065 | } | 1068 | } |
1066 | return 3; | 1069 | return 3; |
1067 | } | 1070 | } |