summaryrefslogtreecommitdiff
path: root/src/ltablib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ltablib.js')
-rw-r--r--src/ltablib.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ltablib.js b/src/ltablib.js
index eaaf24d..210a119 100644
--- a/src/ltablib.js
+++ b/src/ltablib.js
@@ -192,7 +192,7 @@ const auxsort = function(L) {
else if (typeof b[0] !== 'number') return -1;
return lapi.lua_compare_(L, a[1], b[1], lua.LUA_OPLT) === 1 ? -1 : 1; /* a < b */
})
- .forEach((e, i) => typeof e[0] === 'number' ? t.value.set(i, e[1]) : true);
+ .forEach((e, i) => typeof e[0] === 'number' ? t.value.set(i + 1, e[1]) : true);
} else {
[...t.value.entries()]
.sort(function (a, b) {
@@ -207,7 +207,7 @@ const auxsort = function(L) {
lapi.lua_pop(L, 1); /* pop result */
return res ? -1 : 1;
})
- .forEach((e, i) => typeof e[0] === 'number' ? t.value.set(i, e[1]) : true);
+ .forEach((e, i) => typeof e[0] === 'number' ? t.value.set(i + 1, e[1]) : true);
}
};