tags:

views:

105

answers:

1

My favourite language these days is Lua. I have only one issue with it, why on earth is its default behaviour that variables in functions are global? In the similar language Icon there is a keyword "global" that is used when one really wants to use a global instead of the natural behaviour to default to local (I was bitten by this again five minutes ago). I would feel better about this if somebody could tell me the rational behind it (like the scoping difficulties that I know cause the absence of a "continue" keyword in Lua).

+5  A: 

See Why aren't variables locally scoped by default? in the Lua uFAQ.

lhf
+1 For Lua uFAQ, it is a very recommended read.
ponzao