lua-users home
lua-l archive

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


2014-04-25 2:34 GMT+02:00 Hisham <h@hisham.hm>:
> On 21 April 2014 18:23, Thijs Schreijer <thijs@thijsschreijer.nl> wrote:
>>> -----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.
>
> Oh, I missed Roberto's reply in the thread from 2012:
>
>> It seems clear (to me, at least) that Lua does not interfere with what
>> you do with your own tables. The Lua convention refers only to its
>> own tables (the global environment and the registry).
>
> Should this convention be now extended to local variables then?

Why?