aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ltable.c b/ltable.c
index e969adef..40a4683f 100644
--- a/ltable.c
+++ b/ltable.c
@@ -384,7 +384,7 @@ int luaH_next (lua_State *L, Table *t, StkId key) {
384 int tag = *getArrTag(t, i); 384 int tag = *getArrTag(t, i);
385 if (!tagisempty(tag)) { /* a non-empty entry? */ 385 if (!tagisempty(tag)) { /* a non-empty entry? */
386 setivalue(s2v(key), i + 1); 386 setivalue(s2v(key), i + 1);
387 farr2val(t, i + 1, tag, s2v(key + 1)); 387 farr2val(t, i, tag, s2v(key + 1));
388 return 1; 388 return 1;
389 } 389 }
390 } 390 }
@@ -692,7 +692,7 @@ static void reinsertOldSlice (lua_State *L, Table *t, unsigned oldasize,
692 int tag = *getArrTag(t, i); 692 int tag = *getArrTag(t, i);
693 if (!tagisempty(tag)) { /* a non-empty entry? */ 693 if (!tagisempty(tag)) { /* a non-empty entry? */
694 TValue aux; 694 TValue aux;
695 farr2val(t, i + 1, tag, &aux); /* copy entry into 'aux' */ 695 farr2val(t, i, tag, &aux); /* copy entry into 'aux' */
696 luaH_setint(L, t, i + 1, &aux); /* re-insert it into the table */ 696 luaH_setint(L, t, i + 1, &aux); /* re-insert it into the table */
697 } 697 }
698 } 698 }
@@ -937,7 +937,7 @@ int luaH_getint (Table *t, lua_Integer key, TValue *res) {
937 if (keyinarray(t, key)) { 937 if (keyinarray(t, key)) {
938 int tag = *getArrTag(t, key - 1); 938 int tag = *getArrTag(t, key - 1);
939 if (!tagisempty(tag)) 939 if (!tagisempty(tag))
940 farr2val(t, key, tag, res); 940 farr2val(t, key - 1, tag, res);
941 return tag; 941 return tag;
942 } 942 }
943 else 943 else
@@ -1048,11 +1048,11 @@ int luaH_psetint (Table *t, lua_Integer key, TValue *val) {
1048 if (keyinarray(t, key)) { 1048 if (keyinarray(t, key)) {
1049 lu_byte *tag = getArrTag(t, key - 1); 1049 lu_byte *tag = getArrTag(t, key - 1);
1050 if (!tagisempty(*tag) || checknoTM(t->metatable, TM_NEWINDEX)) { 1050 if (!tagisempty(*tag) || checknoTM(t->metatable, TM_NEWINDEX)) {
1051 fval2arr(t, key, tag, val); 1051 fval2arr(t, key - 1, tag, val);
1052 return HOK; /* success */ 1052 return HOK; /* success */
1053 } 1053 }
1054 else 1054 else
1055 return ~cast_int(key); /* empty slot in the array part */ 1055 return ~cast_int(key - 1); /* empty slot in the array part */
1056 } 1056 }
1057 else 1057 else
1058 return finishnodeset(t, getintfromhash(t, key), val); 1058 return finishnodeset(t, getintfromhash(t, key), val);
@@ -1126,7 +1126,7 @@ void luaH_set (lua_State *L, Table *t, const TValue *key, TValue *value) {
1126*/ 1126*/
1127void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { 1127void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) {
1128 if (keyinarray(t, key)) 1128 if (keyinarray(t, key))
1129 obj2arr(t, key, value); 1129 obj2arr(t, key - 1, value);
1130 else { 1130 else {
1131 int ok = rawfinishnodeset(getintfromhash(t, key), value); 1131 int ok = rawfinishnodeset(getintfromhash(t, key), value);
1132 if (!ok) { 1132 if (!ok) {