lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br  Thu Jul 13 17:58:12 2000
>From: Aaron Kamienski <aaronk@snaptwo.com>
>
>I have noticed that the documentation (3.2 and 4.0) for the 
>set/getglobal tag methods is slightly incorrect.  It shows
>their "signatures" as:
>
>	function setglobal(varname, newvalue)
>	function getglobal(varname)
>
>when it should show:
>
>	function setglobal(varname, oldvalue, newvalue)
>	function getglobal(varname, oldvalue)

No, the documentation is correct, even if it's not clear.
The text before them says:
   The semantics of tag methods is better explained by a Lua function
   describing the behavior of the interpreter at each event.

So, setglobal is a *description* of what happens when a global variable is set.
In other words, a=x is equivalent to setglobal("a",x), as it should.

If you look closely at the body of setglobal, you'll see that it calls
	tm(varname, oldvalue, newvalue)
ie, that's the signature of the setglobal tag method, like you said.
--lhf