lua-users home
lua-l archive

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


2014-04-15 15:46 GMT+02:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:

> Can you be more concrete about LPeg? I have been testing LPeg both
> with Lua 5.2 and Lua 5.3 and did not see any difference.

The `lpeg.so` made for Lua 5.2 by `luarocks install lpeg` under Ubuntu 12.04
is loaded without error by Lua 5.3.

However, the result of running it is not as expected in the case
of position matches.

Lua 5.3.0 (work2)  Copyright (C) 1994-2014 Lua.org, PUC-Rio
> lpeg=require"lpeg"
> p=lpeg.P(3); c=lpeg.C(3)
> c:match"abc"
abc
> ("%X"):format(p:match"abc")
8A3C00800000004
> _G
table: 0x8a3c3c0

The result seems to be the concatenation of an address and
the correct value 4. That address has the same relationship
to the address of _G as shown above: last 3 hex digits 008
where G has last 3 hex digits 3c0.

If instead I build lpeg from source, obtained by `luarocks download lpeg`
and `luarocks unpack lpeg`, changing LUADIR to the
5.3.0-work2 directory, and doing `luarocks --local make`,
the same thing happens.

If instead of `luarocks --local make` I just say `make`,
after `make clean` of course, the same thing happens.