lua-users home
lua-l archive

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


On Fri, 26 Apr 2013 13:13:33 +0200
Thomas Jericke <tjericke@indel.ch> wrote:

> On 04/25/2013 10:54 PM, Steve Litt wrote:
> > I would too. If I really want something to be global, I'll
> >
> > global myvar = 0
> >
> > It's not like I'm going to have 40 globals anyway, so this won't be
> > much writing.
> >
> To me there are still some problems regarding scoping with this,
> consider:
> 
> if someboolean then
>      global myvar = 0
> end
> 
> print(myvar) -- Is this valid?

Why in the world would anyone do this? I can't think of any reason for a
global variable's existence to be conditional.


SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance