lua-users home
lua-l archive

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

On Sun, Sep 6, 2009 at 5:53 PM, Phoenix Sol<> wrote:
>> All threads would use the same ***instance*** of all globals, so if you
>> save something in a global variable in one thread, it affects all threads.
>> This is a very undesirable trait in server threads.  If you forget to make a
>> variable local and write to it you have a problem.
> I hate to say it, but I think that this is a flaw with Lua. Most of the time
> you want to declare locals, and that should be the default.

Unfortunately, it turns out local-by-default would cause more problems
than it would solve, due to Lua's scoping. Mike Pall's post about it
here is probably the best summary:

There's also a page on the Lua Users' Wiki: