lua-users home
lua-l archive

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

On Thu, Feb 11, 2016 at 7:15 PM, Peter Aronoff <> wrote:
> Daurnimator <> wrote:
>> The other thing to note is that fields starting with '_' are customarily
>> reserved. From
>> "As a convention, programs should avoid creating names that start with an
>> underscore followed by one or more uppercase letters (such as _VERSION)."
> This has come up more than once in this thread, so here's a question:
>         Do people think that variables of this kind are a bad idea even
>         when they're namespaced under the exported module's table?
>         That is, I use names *exactly* like _VERSION, but not in the
>         toplevel environment. Does this still violate the spirit of the
>         manual's injunction or is it fine?
> Discuss.

I have always interpreted the manual's "convention" as referring
specifically to global names (i.e. fields in _G), since Lua may use
such names for its own purposes (e.g. _G and _VERSION). I've never
interpreted it to mean that such names should be avoided even in
module tables, since Lua itself doesn't use such names anywhere but