"jbrave" wrote:
this="function1name"
this(id)
but I get:
Member function not found in BrightScript Component or interface.
I can explicitly call bigfunc.lable1(id)
and the function executes.
is there a way to do this without using exec()
- Joel
That's PHP style, which is sort of it's own unique PHP thing (go figure).
I'm not sure, but if it's a regular function, you may have to use eval(). If it's actually a method on an object, you are in luck. Gander at this:
function func1()
print m.v1
end function
manualObj = {
v1: 1
f1: func1
f2: func2
}
print manualObj.v1 ' prints "1"
print manualObj["v1"] ' also prints "1"
varname = "v1"
print manualObj[varname] ' prints "1" yet again
manualObj.f1() ' prints "1"
manualObj["f1"]() ' also prints "1"
funcname = "f1"
manualObj[funcname]() ' prints "1" yet again
The thing to remember is that a variable can
contain a function, just as it can contain a value. In this case, a function is just a special type, like an int or string. In a language this is called "first class functions" (
http://en.wikipedia.org/wiki/First-class_function). It's different than PHP, much more powerful and actually more common. The way[ to determine whether you are
calling the function or
accessing it's code/contents is whether you append the parenthesis (manualObj.f1 vs manualObj.f1() above).
-- GandK Labs
Check out Reversi! in the channel store!