lua-users home
lua-l archive

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


>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