scope is ok now. but lpeg type problem still exists
► _VERSION
"LuaRT 1.7.1"
► lpeg = require'lpeg'
► p = lpeg.P'test'
► type(p)
"lpeg-pattern"
► tostring(p)
"lpeg-pattern: 0000016E24AF4498"
► p
pretty.lua:39: attempt to compare number with lpeg-pattern
crash and exit immediately
problem is this line:
if #value > 0 then
if the value is not a table, but other type like lpeg pattern, then it can not be used with # operator
-- edit
actually lpeg pattern can be used with # operator, but return another pattern, instead of return an int number
lua is so flexible that any operator can return any type value. charm of dynamic language?