lua-users home
lua-l archive

Re: Question about using Lua for defining GUIs

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


RLake@oxfam.org.uk:
> Interesting... without looking at the Lua parser or trying anything, my
> hunch is that you're running into a line-end-aware issue introduced with
> Lua 5.
Hmm, I take back the comments I made a few weeks ago about the line-end
aware issue. I think I misunderstood the (admittedly unclear) comment in the
manual. It says:
 "As an exception to the format-free syntax of Lua, you cannot put a line
 break before the ( in a function call. That restriction avoids some
 ambiguities in the language. If you write
 a = f
 (g).x(a)
 Lua would read that as 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)."
The manual comment is a little confusing. On one hand it says:
 "If you actually want to call f, you must remove the line break before
 (g)"
but on the other it says that for:
 a = f
 (g).x(a)
that:
 "Lua would read that as a = f(g).x(a)"
Having checked the executable it seems that indeed, if you use the ambiguous
syntax, then the compiler will detect it and return that as an error. Ie, it
*does* check the newline (something which would normally be stripped by the
lexical analyser). Not very nice :-(.
*cheers*
Peter Hill.

AltStyle によって変換されたページ (->オリジナル) /