4 Jul 02:45
lpeg question
Norbert Kiesel <nkiesel <at> tbdnetworks.com>
2009-07-04 00:45:05 GMT
2009-07-04 00:45:05 GMT
Hi,
I started to play around a bit with lpeg and found a (for me) suprising
behavior: the following lua code
lpeg=require"lpeg"
require"re"
print("lpeg version", lpeg.version())
x = {re.find('hello', [[ { 'h' . . } { . } { . } -> {} ]])}
print(type(x), #x, x[1], x[2], x[3], x[4])
print(type(x[4]), #x[4], x[4][1])
prints
lpeg version 0.8
table 4 1 hel l table: 0x6c7710
table 1 o
I would have expected to get
lpeg version 0.8
table 4 1 hel l o
string 1 nil
why is the last capture returned as a table?
</nk>
RSS Feed