lua-users home
lua-l archive

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

On 05/10/2016 08:32 PM, Andrew Starks wrote:

On Tue, May 10, 2016 at 11:58 Viacheslav Usov <> wrote:
On Tue, May 10, 2016 at 6:32 PM, Dirk Laurie <> wrote:

> This is like asking a famous chef

If you use Lua for fun, that might be a valid comparison.

I use Lua to get things done. So in my case the comparison would be more like asking the manager of my plant's canteen: is there a major reason our plant needs to suffer from massive outbursts of profuse diarrhea every so often? Why can't we have basic food safety measures in place?


To answer your question: One of Lua's main use cases is as a configuration language. That is: <yourconfigfile.lua> Window_x = 5 Window_y = 100 a very useful syntax for a configuration file that you might employ in your application. Adding "global" or "local" to the front of each declaration would be ugly and detract from this simplicity. Hopefully, in this context, we can agree that "global by default" makes some sense. -Andrew

I don't think it's a bad idea to structure your configuration parameters. And once you do that you don't have that many globals in configuration files either:

return {
    Window = {
        x = 5
        y = 100