lua-users home
lua-l archive

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


Solved! It was the 4 spaces on a seemingly empty line that were the problem. My editor's preferences (BBEdit on Macintosh) were set to "Strip trailing whitespace". Changing that made the error disappear.
May I suggest to for example print a warning pointing this out, in case the check fails? It is a fairly obscure problem to solve (it least for me ;-) Maybe not everyone runs the test, but every now and then someone stumbling over the same problem must be annoying.
Thanks for the quick and adequate respons.

Hans van der Meer



On 28 dec. 2011, at 18:48, Roberto Ierusalimschy wrote:

>> Thanks, I completely overlooked this!!
>> 
>> But being able running the test does not seem to solve all problems. I carefully removed all other lpeg.so versions from my path, but test.lua gives the following error:
>> 
>> /usr/local/bin/lua: ./test.lua:24: assertion failed!
>> stack traceback:
>> 	[C]: in function 'assert'
>> 	./test.lua:24: in function 'checkeq'
>> 	./test.lua:27: in function 'checkeq'
>> 	./test.lua:26: in function 'checkeq'
>> 	./test.lua:26: in function 'checkeq'
>> 	./test.lua:1099: in main chunk
>> 	[C]: in ?
>> The 1099 line is the check on tables.
>> 
>> I added statements for printing at the error:
>> local function checkeq (x, y, p)
>> local p = true
>> print ("type(x)",type(x),"type(y)",type(y))
>> if p then print(x,y) end
>> ..
>> 
>> and the result is:
>> type(x)	string	type(y)	nil
>> 	nil
>> and then the same error of course.
> 
> Can you find the keys that generated this error (that is, the values
> of 'k' in the stacked invocations of 'checkeq')?
> 
> Also, please check this: the test you are running looks like this
> test.lua:1090:
> ---------------------------------
> t= p:match[[
> 1
>  1.1
>  1.2
>    1.2.1
> 
> 2
>  2.1
> ]]
> checkeq(t, {"1", {"1.1", "1.2", {"1.2.1", "", ident = "    "}, ident = "  "},
>            "2", {"2.1", ident = "  "}, ident = ""})
> ---------------------------------
> 
> The line just after '1.2.1' should have exactly four empty spaces.
> Maybe when you edited the file the editor changed it.
> 
> -- Roberto
>