lua-users home
lua-l archive

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


You don't need LPeg for that, gsub does it nicely if the format is fixed:

s = io.read"*a"
io.write(s:gsub("%[(.-)%].-{(.-),%s*(.-)}",function (i,a,b)
		return string.format("[%s] = {%s, %s}",i+10,b,a)
	end)