[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Spaces before brackets - acceptable?
- From: Nick Gammon <nick@...>
- Date: Tue, 7 Jul 2009 17:47:29 +1000
Hello,
I have been using Lua for a few years now, and feel comfortable with
it. It is incorporated into one of my programs which gets thousands of
downloads. However I was recently thrown by a complaint from a user
that my examples on my web site are "wrong" because I gave examples
like:
print ("Hello World")
instead of:
print("Hello World"")
Now we all know that both forms work (with or without the space before
the bracket).
So, I reached for my copy of Programming in Lua, to set him on his
way, explaining that if he only RTFM he would see, that on page XXX it
says that white space is not significant. This is where I hit a
problem. I seem to recall reading it somewhere, but can't find the
page. Searching the online manual on the website for "space" only
returns references to things like "stack space".
The page about "Some Lexical Conventions" for example, does not
mention spaces at all.
I note that many of the examples in Programming in Lua actually omit
the space when explaining function calls.
Even "The Complete Syntax Of Lua" doesn't seem to mention whitespace.
Obviously it is needed to separate words like "local" and "function"
but that seems to be implied.
So please don't laugh, but can someone point me to where it says, on
the official documentation, that a space is OK between a function name
and the bracket which starts the arguments? Thank you.
- Nick Gammon