aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index c0dc2d2..eec086f 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -1110,7 +1110,7 @@ const push_onecapture = function(ms, i, s, e) {
let l = ms.capture[i].len;
if (l === CAP_UNFINISHED) lauxlib.luaL_error(ms.L, lua.to_luastring("unfinished capture", true));
if (l === CAP_POSITION)
- lua.lua_pushinteger(ms.L, ms.src_init + 1);
+ lua.lua_pushinteger(ms.L, ms.capture[i].init - ms.src_init + 1);
else
lua.lua_pushlstring(ms.L, ms.src.slice(ms.capture[i].init), l);
}