lua-users home
lua-l archive

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


Forget about my last workaround...
The same behavior affects debug.getinfo().currentline

_________________
Thadeu de Paula
https://codeberg.org/waxlab
https://codeberg.org/arkt8

------- Original Message -------
Em domingo, 20 de agosto de 2023 às 17:57, Thadeu de Paula <arkt8@proton.me> escreveu:


> As I said, I can manage to repeat the variable each line.
> 
> A thing that we can live, yes.
> A thing that is expected, no.
> 
> I can comprehend the statements, but being not one function call, but distinct ones, the correct line where a call tooks place should be considered or the trace has no meaning. Not less not more. We need to put things as they are, not liveable undocumented workarounds.
> 
> Btw, I found interesting to share this with the official Lua group as something that is --not documented--, that changed somewhere in past and on critical systems may pose some concern.
> 
> By now I found a better way to workaround this, that is error reporting using debug.getinfo(2).currentline.
> 
> _________________
> Thadeu de Paula
> https://codeberg.org/waxlab
> https://codeberg.org/arkt8
> 
> 
> ------- Original Message -------
> Em domingo, 20 de agosto de 2023 às 14:38, Francisco Olarte folarte@peoplecall.com escreveu:
> 
> 
> 
> > 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.