lua-users home
lua-l archive

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


hi,
Now I have a program like

a={}
a["foo"]=function() bar() end
a["bar"]=function () print("Hello") end
function p(t) foo() end
p(a)

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!