lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Thadeu

On Sun, 20 Aug 2023 at 15:27, Thadeu de Paula <arkt8@proton.me> wrote:
...
> I'm testing it against Lua from versions 5.1 to 5.4 but the call stack is inconsistent in newer versions while Lua 5.1 is showing the expected stack.

I think you are expecting too much....

> check(list) -- line 18
>   :check('a')
>     :check('b')
>       :check('c') -- line 21

This is a multiline statement, given my experience with
compilers/interpreters I would expect any line between 18 and 21,
normally 18 or 21 ( this has happened to me, particularly with
compilation errors, in several language which allow multiline
statements ).

> It is expected that the call to ":check('c')" throws an error. This call is on line 21.

Lua compiles, I do not know if it tracks every line number, but I
suspect it just tracks a line number per statement, as it does not
seem to be specified it is free to track the last or the first or
anything in between. You could thighten the language specification,
but when this kind of things are a problem you normally just do

do
  local x = check(list)
  x = x:check(a)
  x = x:check(b)
  x = x:check(c)
end

To get an accurate trace. Using not too defined functionality ( the
traceback contents ) coupled with multiline statements is generally
asking for trouble in any language.

Francisco Olarte.