[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Possible bug with statement parsing?
- From: "Aaron Brown" <arundelo@...>
- Date: Sat, 23 Jun 2007 14:16:08 -0400
Patrick Donnelly wrote:
4: attempt to call a nil value
If you append a semicolon to the end of line 3 however
(forcing the end of the statement?), the error is fixed.
I'm guessing this is a bug because, as I understand it,
semicolons are optional and only intended as syntactic
As an exception to the free-format syntax of Lua, you
cannot put a line break before the '(' in a function call.
This restriction avoids some ambiguities in the language.
If you write
a = f
Lua would see that as a single statement, a = f(g).x(a).
So, if you want two statements, you must add a semi-colon
between them. If you actually want to call f, you must
remove the line break before (g).
As Shmuel pointed out, though, this should be a compile-time
error ("ambiguous syntax").
Who's that on the Red Carpet? Play & win glamorous prizes.