lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Hisham
> Sent: maandag 21 april 2014 19:17
> To: Lua mailing list
> Subject: Request for clarification on reserved names
> 
> 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.


See this thread;
http://article.gmane.org/gmane.comp.lang.lua.general/95848

Your comment on _ENV was not considered in the mentioned thread.

Thijs

> 
> 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