lua-users home
lua-l archive

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


On 03/04/2017 04:43 AM, Peter Aronoff wrote:
> Martin <eden_martin_fuhrspam@gmx.de> wrote:
>> (Personally I prefer to prefix all queries to non-standard
>> global table values with "_G.".)
> 
> This may be a tangent, but what do you mean by saying you “prefer to prefix
> all queries to non-standard global table values with "_G"”? What would
> a “non-standard global table value” even be? Isn’t the whole point of _G
> that the values that are (already) there are standard?

I mean when I add something to global table I tend to write
it explicit:

  local my_new_func = function() end
  ...
  _G.new_func = my_new_func

And if I doubts in clarity need I may call it as

  _G.new_func(...)

Surely I don't write

  for k, v in _G.pairs(t) do end

As all values that in _G when you just loaded interpreter
I consider "standard".

-- Martin