[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: get/setglobal
- From: "Michael Flad" <Michael@...>
- Date: Tue, 25 Sep 2001 15:40:06 +0200
Hi,
i think i must be really stupid today, whats wrong
with these simple lines of code.
At the last line Hello has the value nil and so
the call fails.
Lua calls setglobal for "Hello" while executing the
function definion and i expect a value of type
"function" as second parameter but what i get is "nil".
Am i missing something here?
function GetGlobal( varname )
print( "Get global: "..varname )
rawget( globals(), varname )
end
function SetGlobal( varname, value )
print( "Set global: "..varname )
rawset( globals(), varname, value )
end
settagmethod( tag(nil), "getglobal", GetGlobal )
settagmethod( tag(nil), "setglobal", SetGlobal )
function Hello()
print( "Hello called" )
end
Hello()
TIA,
Michael Flad
--
Fantastic Realms Interactive GmbH
Birnenweg 15 - D-72766 Reutlingen
Germany