lua-users home
lua-l archive

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


caseyh@istar.ca writes:

> Quoting Geoff Leyland <geoff_leyland@fastmail.fm>:
>
>> On 12/07/2010, at 5:14 AM, Roberto Ierusalimschy wrote:
>>
>>> I still think the main problem is non-intended assignment to globals,
>>> which creates hard-to-find bugs. The simple policy of requiring a global
>>> declaration to assign to globals would force programmers to consider
>>> whether they really want a global variable.
>>
>> One possible downside of this is that this very simple Lua program:
>>
>> a = "Hello World"
>> print(a)
>>
>> becomes:
>>
>> global a = "Hello World"
>> print(a)
>>
>> (or "local a...").  Does this make Lua harder to learn?
>
> Arrrrrrrgh!
>
> I thought ONLY within a function one would have to use the "global"
> prefix and not use the prefix at the top level.

Is there a top level?

-- 
David Kastrup