Reference Function Name Via Variable?

Kay C Lan lan.kc.macmail at gmail.com
Fri Jan 16 02:30:54 EST 2009


On Fri, Jan 16, 2009 at 8:55 AM, Scott Rossi <scott at tactilemedia.com> wrote:

> I'm trying to be economical.  I have about 12 functions that do different
> processing routines but they all use the same parameters.  I want to be
> able
> to programmatically call the name of each function using a combination of
> variables, so I can end up using one master function to handle all 12.
>

If you already have the 12 functions then how about this - I'm using inbuilt
functions because I have no idea what yours do:

ON mouseUp
    put "avg,sum,min,max" into tFuncList
    put 123,456,789  into tParamList

    REPEAT FOR each item tFunc in tFuncList
        put tFunc && value(merge("[[tFunc]]([[tParamList]])")) & cr after
tResults
    END repeat

    put tResults into msg
END mouseUp

HTH



More information about the use-livecode mailing list