d:\>cat pcall-wrong-lineno.lua
pcall(function()
print(debug.traceback())
end)
d:\>lua pcall-wrong-lineno.lua
stack traceback:
pcall-wrong-lineno.lua:2: in function <pcall-wrong-lineno.lua:1>
[C]: in function 'pcall'
pcall-wrong-lineno.lua:1: in main chunk
[C]: at 0x00402180
d:\>lua luajit-lang-toolkit\run.lua pcall-wrong-lineno.lua
stack traceback:
pcall-wrong-lineno.lua:2: in function <pcall-wrong-lineno.lua:1>
[C]: in function 'pcall'
pcall-wrong-lineno.lua:3: in function 'fn'
luajit-lang-toolkit\run.lua:73: in main chunk
[C]: at 0x00402180
d:\>lua -v
LuaJIT 2.0.2 -- Copyright (C) 2005-2013 Mike Pall. http://luajit.org/
Doesn't have to be pcall specifically, and it seems it uses the last line of the function declaration, unlike Lua and LuaJIT, which use the line on which the outer function call occurs:
function call(_, fn)
fn()
end
call(
"ignored",
function()
print(debug.traceback())
end,
"also ignored"
)
Lua/LuaJIT report line 5 (where call is), luajit-lang-toolkit reports line 11 (where the function declaration ends).
Doesn't have to be
pcall
specifically, and it seems it uses the last line of the function declaration, unlike Lua and LuaJIT, which use the line on which the outer function call occurs:Lua/LuaJIT report line 5 (where
call
is), luajit-lang-toolkit reports line 11 (where the function declaration ends).