Passing unknown number of referenced variables to a function
Ken Ray
kray at sonsothunder.com
Thu Oct 28 13:26:15 EDT 2004
On 10/28/04 11:53 AM, "Dr.John R.Vokey" <vokey at uleth.ca> wrote:
> Not true; just create the function with more input variables than you
> would ever need to pass to it, then use the paramCount and params
> functions within it to retrieve those passed.
Unfortunately that only works with "regular" parameters; you can't do that
with pass-by-reference params because you need to have something passed for
each param to the function. For example, the following won't work:
on test
put 10 into tVar
get add10(tVar)
end test
function add10 @pVar1, at pVar2
add 10 to pVar1
add 10 to pVar2
end add10
It will error out unless you provide a second "dummy" variable:
on test
put 10 into tVar
put 0 into tDummy
get add10(tVar,tDummy)
end test
And that would be really ugly (among other things)...
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list