24 lines
617 B
Text
24 lines
617 B
Text
-- parent script "CallFunction"
|
|
|
|
property _code
|
|
|
|
-- if the function is supposed to return something, the code must contain a line that starts with "res="
|
|
on new (me, code)
|
|
me._code = code
|
|
return me
|
|
end
|
|
|
|
on call (me)
|
|
----------------------------------------
|
|
-- If custom arguments were passed, evaluate them in the current context.
|
|
-- Note: in the code passed to the constructor they have to be referenced
|
|
-- as arg[1], arg[2], ...
|
|
arg = []
|
|
repeat with i = 3 to the paramCount
|
|
arg[i-2] = param(i)
|
|
end repeat
|
|
----------------------------------------
|
|
res = VOID
|
|
do(me._code)
|
|
return res
|
|
end
|