[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Request for clarification on reserved names
- From: Hisham <h@...>
- Date: Mon, 21 Apr 2014 14:17:00 -0300
The Lua 5.2 (and 5.3) manual(s) say:
Lua is a case-sensitive language: and is a reserved
word, but And and AND are two different, valid names.
As a convention, names starting with an underscore
followed by uppercase letters (such as _VERSION)
are reserved for variables used by Lua.
Does that mean (a) all names, (b) global variables only or (c) all variables?
The text says "names" which strictly speaking would mean option "a"
but I doubt this applies to table fields, so my original
interpretation was "b", but then I remembered that _ENV is special
even if it's a local variable (and yes, I've had to patch Lua 5.1 code
out there which used "_ENV" as a regular variable). I've also seen
tutorials out there that inadvertedly suggest _M (ugh) as a table name
for declaring modules.
This request comes in light of the recommendation in [2] to put
descriptive fields such as module._VERSION in module tables.
http://kiki.to/blog/2014/03/31/rule-2-return-a-local-table/
I assume those are fine, but then it would be good to get the wording
clearer in the manual.
Thanks!
-- Hisham