Variable parameter synonym functions

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Oct 23 08:29:36 EDT 2014


Hi Mikey,

Here's a way:

on mouseUp
      put fun1("a","b")
end mouseUp

function fun1
      repeat with x = 1 to the paramcount
           put param(x) & comma after myList
      end repeat
      put "fun2(" & char 1 to -2 of myList & ")" into myFun
      return value(myFun)
end fun1

function fun2
      return the paramcount
end fun2

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 10/23/2014 13:51, Mikey wrote:
> Has anybody come up with an easy way to write functions or handlers that are synonyms for other functions/handlers where both take a variable number of parameters?
>
> If I want to have a handler "a" and synonym "aardvark", I would normally write
>
> on a name
>     aardvark name
> end a
>
> on aardvark name
>     answer "I'm an aardvark named"&&name
> end aardvark
>
>
> Now imagine doing that while supporting a variable number of parameters.
>
> Sent from my iPhone
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list