[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: setfenv, how to...
- From: "Leandro Candido" <enclle@...>
- Date: Mon, 10 Nov 2003 20:31:45 -0200
... Let a function with an enviromment call another with other enviromment?
Example:
-- block
tab = {}
function tab.afunc()
print("Inside tab.afunc");
end
setfenv(tab.afunc, tab);
-- end block
The code above raise an error with "attempt to call global 'print' (a
nil value)". Yes, I know that the code is trying to call tab.print, but how
to set it to call the real print? (Please, I know too that I can write
tab.print = print; but this isn't what I want).
The
God's Peace,
Leandro.