[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [UNANTICIPATED SIDE EFFECT] debug.getlocal does not pick up vararg (Was: [BUG]
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 27 Jul 2016 09:40:57 +0200
2016-07-27 8:54 GMT+02:00 Xavier Wang <weasley.wx@gmail.com>:
> 2016-07-26 20:17 GMT+08:00 Dirk Laurie <dirk.laurie@gmail.com>:
>> 2016-07-26 14:03 GMT+02:00 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>>> Here is a similar script that is easier to interpret:
>>>
>>> function f(a,b,...) for k=-4,4 do print(k,debug.getlocal(1,k)) end end
>>> f(10,20,30,40,50)
>>>
>>> The output is below.
>>> Your complaint is that 5.3.2 no longer shows "(*vararg)" and their values?
>>
>> Yes. It is totally redundant to say "Negative indices refer to vararg
>> parameters; -1 is the first vararg parameter." when exactly the same
>> result is returned whether or not the parameter is actually present.
>>
>
> because you doesn't really *use* the vararg, try this:
>
> function f(a,b,...) for k=-4,4 do print(k,debug.getlocal(1,k)) end
> local _ = ... end
> f(10,20,30,40,50)
Thanks to this insight of yours, I have changed the subject line.