lua-users home
lua-l archive

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


2010/3/5 leeya <leeyacn@126.com>:
> But, when I tried to test test.lua scripts coming from lpeg-0.9, I got
> trouble below:
>
>> local m = require"lpeg"
>> any = m.P(1)
> stdin:1: attempt to index global 'm' (a nil value)
> stack traceback:
>         stdin:1: in main chunk
>         [C]: ?

The problem here is that if you define a local variable at the
command-line prompt, it only exists for that line. Try taking out the
word 'local' from the require statement, so it is just:

>m = require "lpeg"

...and it should work.

-Duncan