[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: debug.setlocal does not correctly restore values for variables localized inside subblocks (or so it seems)
- From: Paul K <paulclinger@...>
- Date: Mon, 23 Jul 2012 17:56:18 -0700
On Thu, Jul 19, 2012 at 10:45 PM, Declan White <email@example.com> wrote:
>> It looks like debug.setlocal does not correctly restore variables that
>> are localized inside subblocks in a function.
> You are storing the local variables by name, but their identifying key is numeric.
> To solve this, simply store by numeric local ID, rather than name.
It turned out to be not that simple as I want to be able to use the
same table to pass to setfenv(func, env) as an environment, so I need
those variables to be stored by name.
I ended up changing the way I process them and going from large IDs to
1 to make sure that I only update the innermost local variables and
ignore all others with the same name.