[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Behaviour of "local"
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 22 Feb 2001 08:26:43 -0300 (EST)
>I noticed that if you define a variable outside of
>a function as local, then any global function that references it is
>implicitly local as well. This makes sense, but I was more expecting
>something like an error message or for the function to try and access a
>global.
You do get an error message. See below. Perhaps you could post a small sample
of what you mean.
$ cat i
local x
function f()
print(x)
end
$ lua -v i
Lua 4.0 Copyright (C) 1994-2000 TeCGraf, PUC-Rio
error: cannot access a variable in outer scope;
last token read: `x' at line 4 in file `i'
--lhf