summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ldebug.js2
-rw-r--r--tests/ldblib.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/ldebug.js b/src/ldebug.js
index aed41e2..18a36a6 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -18,7 +18,7 @@ const CT = defs.constant_types;
const TS = defs.thread_status;
const currentline = function(ci) {
- return ci.func.value.p.lineinfo ? ci.func.value.p.lineinfo[ci.pcOff] : -1;
+ return ci.func.value.p.lineinfo ? ci.func.value.p.lineinfo[ci.pcOff-1] : -1;
};
/*
diff --git a/tests/ldblib.js b/tests/ldblib.js
index 4569e98..1adfef5 100644
--- a/tests/ldblib.js
+++ b/tests/ldblib.js
@@ -351,7 +351,7 @@ test('debug.traceback (with a global)', function (t) {
\t[string "traceback-test"]:7: in function 'rec'
\t[string "traceback-test"]:7: in function 'rec'
\t[string "traceback-test"]:7: in function 'rec'
-\t[string "traceback-test"]:15: in main chunk`,
+\t[string "traceback-test"]:13: in main chunk`,
"Correct element(s) on the stack"
);
@@ -410,7 +410,7 @@ test('debug.traceback (with a upvalue)', function (t) {
\t[string "traceback-test"]:8: in upvalue 'rec'
\t[string "traceback-test"]:8: in upvalue 'rec'
\t[string "traceback-test"]:8: in local 'rec'
-\t[string "traceback-test"]:16: in main chunk`,
+\t[string "traceback-test"]:14: in main chunk`,
"Correct element(s) on the stack"
);