lua-users home
lua-l archive

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


Hrm, that certainly sounds promising, but, I think one of the email servers is mangling the patch file -- my attempts to apply it are giving me a "malformed patch" error.  Can you try emailing it inside a zip?

On Fri, Feb 17, 2012 at 2:47 PM, Xavier Wang <weasley.wx@gmail.com> wrote:
Sorry for that, that's because Lua 5.2 changed the semantics of
globals. in Lua 5.1 the K code of name of a global variable is stored
in the u.info of expdesc, but in Lua 5.2 there is no VGLOBAL any more,
only VINDEXED as global (x is the semantics sugar of _ENV.x), so we
should take names from u.ind.idx.

try to using this one? It works with your code :-)

2012/2/18 Sven Olsen <sven2718@gmail.com>:
> Thanks for sharing that :)
>
> Unfortunately, I'm hitting bugs when I try to apply the patch.  A little
> experimenting shows that I can sometimes trigger access violations in
> luaV_execute when executing this simple chunk:
>
> local _ENV = {}
> a in _ENV
>
> But, I'm not quite sure how to debug this.  Switch the "a in _ENV" to "local
> a in _ENV" gets rid of the error, so falling back on RiscLua's minimal
> version of the patch seems safe...
>
> -Sven
>
>
>
> On Fri, Feb 17, 2012 at 1:34 AM, Xavier Wang <weasley.wx@gmail.com> wrote:
>>
>> I have made one several months ago.
>>
>> Any feedback welcome :-)
>>
>>
>>
>> 2012/2/17 Sven Olsen <sven2718@gmail.com>:
>> > Since upgrading to 5.2, I've been missing Peter Shook's "unpack tables
>> > by
>> > name" patch.  RiscLua includes a 5.2 compatible version of the patch,
>> > but,
>> > it's strictly limited to the case of unpacking locals, whereas
>> > the original 5.1 patch would unpack into arbitrary variables.
>> >  I preferred the old patch because it made it possible to selectively
>> > copy
>> > pieces of a table without the need to quote variable names, i.e.,
>> >
>> > _ENV=env1
>> > a,b,c,d in env2
>> >
>> > Does anyhow have a 5.2 version of the patch that supports the old
>> > semantics?
>> >  (My own attempt to update Peter's 5.1 code to the 5.2 parser failed
>> > miserably.)
>> >
>> > Thanks,
>> >
>> > -Sven
>