[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: How to set the environment of a function
- From: "Sherry Zhang" <yuleopen@...>
- Date: Sun, 8 Jul 2007 07:11:26 +0800
Now I have a program like
a["foo"]=function() bar() end
a["bar"]=function () print("Hello") end
function p(t) foo() end
when running p(a) , I want to get the "Hello" output.
and I want to know two easy way to do that.
( I do not ways like for k, v in pairs(t) do ... end)
1 how to set it outside the function and leave the function unmodified?
2 how to set it inside the function?
thanks in advance!