How to call non-global functions by name?
Hi!
I've got the following problem.
Suppose the string f contains the name of a function. If f is a global function, I can call ist via the environment _G. Like
f = "UnitHealth"
health = _G[f]("player"),
but if f is a function, like all these functions in Ace Addons, this does not seem to work, i.e.:
f = "sRaidFrames.Print"
_G[f]("Hello World!")
returns an error. Is there a way to make this work? =)
I hope I've made my problem clear. Please don't ask me, why I'd want to do that. I want it =)
Thanks much!
Vaeyl
Last edited by ngollon : 03-21-07 at 02:38 PM.
|