diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-10-30 14:25:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-10-30 14:25:59 -0300 |
commit | 43c8e5bded052801f54a7439d18933b83570eb82 (patch) | |
tree | 97f6d1e020110e14c798537c7bbb1f90feed4044 /ltests.c | |
parent | b8b709b6d40c5c18d9b8ef33bb50afc55f048ab8 (diff) | |
download | lua-43c8e5bded052801f54a7439d18933b83570eb82.tar.gz lua-43c8e5bded052801f54a7439d18933b83570eb82.tar.bz2 lua-43c8e5bded052801f54a7439d18933b83570eb82.zip |
Full abstraction for representation of array values
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -362,8 +362,11 @@ static void checktable (global_State *g, Table *h) { | |||
362 | Node *n, *limit = gnode(h, sizenode(h)); | 362 | Node *n, *limit = gnode(h, sizenode(h)); |
363 | GCObject *hgc = obj2gco(h); | 363 | GCObject *hgc = obj2gco(h); |
364 | checkobjrefN(g, hgc, h->metatable); | 364 | checkobjrefN(g, hgc, h->metatable); |
365 | for (i = 0; i < asize; i++) | 365 | for (i = 0; i < asize; i++) { |
366 | checkvalref(g, hgc, &h->array[i]); | 366 | TValue aux; |
367 | arr2obj(h, i + 1, &aux); | ||
368 | checkvalref(g, hgc, &aux); | ||
369 | } | ||
367 | for (n = gnode(h, 0); n < limit; n++) { | 370 | for (n = gnode(h, 0); n < limit; n++) { |
368 | if (!isempty(gval(n))) { | 371 | if (!isempty(gval(n))) { |
369 | TValue k; | 372 | TValue k; |
@@ -1005,7 +1008,8 @@ static int table_query (lua_State *L) { | |||
1005 | } | 1008 | } |
1006 | else if ((unsigned int)i < asize) { | 1009 | else if ((unsigned int)i < asize) { |
1007 | lua_pushinteger(L, i); | 1010 | lua_pushinteger(L, i); |
1008 | pushobject(L, &t->array[i]); | 1011 | arr2obj(t, i + 1, s2v(L->top.p)); |
1012 | api_incr_top(L); | ||
1009 | lua_pushnil(L); | 1013 | lua_pushnil(L); |
1010 | } | 1014 | } |
1011 | else if ((i -= asize) < sizenode(t)) { | 1015 | else if ((i -= asize) < sizenode(t)) { |