lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
However, the Lua parser takes the preceding "-" and does not
pass it to the numeric conversion routine.

Instead, it passes everything AFTER the "-" and then does the
unary minus as defined for the default arithmetic type.

Most languages do this. If you include the "-" as part of the number
you will need some trick to parse "x-1", as it would read as a variable
("x") followed by a constant ("-1"), with no operation.

I understand the reason behind the requirement, I just did not
appreciate the side effects until I ran into the problem :-)

The language and the Lua interpreter is operating exactly as it
was designed and intended to in this case, it's my workaround
that is at fault.

All this shows is that no matter how carefully one may consider
a patch or change to a system, only extensive testing will prove
that it works and more importantly that nothing else got broken.

Cheers, Ralph