synonyms

Mike Bonner bonnmike at gmail.com
Wed Jun 28 10:14:17 EDT 2017


Even easier would be to just pass a single string like so..

myhandler "type=blue,name=fred,something=234"

And use split

split pVar by comma and "="

ending up with an array keyed by name.

On Wed, Jun 28, 2017 at 5:41 AM, Paul Dupuis via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Here is some code to pass params by name - value pairs. It is relatively
> easy with the paramCount and param functions of livecode.
>
> on mouseUp
>
>   myHandler "type=blue","name=fred","something=234"
>
> end mouseUp
>
>
> on myHandler
>
>   repeat with i=1 to the paramCount
>
>     put param(i)&cr into tArg
>
>     set itemDel to "="
>
>     put item 1 of tArg into tName
>
>     put item 2 of tArg into tValue
>
>     put "Name:"&&tName&&"= Value:"&&tValue&cr after msg
>
>   end repeat
>
> end myHandler
>
>
>
>
> On 6/28/2017 2:42 AM, FlexibleLearning.com via use-livecode wrote:
> > This is how ChartMaker (www.flexibleLearning.com/chartmaker ) works,
> with
> > only the required name-value pairs and in any order. It does make
> > implementing modifications to chart displays a lot easier for exactly the
> > reasons you give!
> >
> > Hugh Senior
> > FLCo
> >
> >> -----Original Message-----
> >> I don't know when OL will be available or how it'll work.  I only know
> >> one thing it won't support, based on an earlier conversation with Mark
> >> Waddingham:  R-style arguments (similar in many respects to CSS values).
> >>
> >> In R, things like the plot command have reasonably-useful defaults, so
> >> that you can just pass in data with nothing else and get a useful
> result.
> >>
> >> But if you want to tailor it you pass arguments in as name-value pairs,
> >> e.g.:
> >>
> >>    plot(cars, type="o", col="blue", ylim=c(0,12))
> >>
> >> What I like about that is I'm free from having to remember parameter
> >> order, which also means I don't need to add a hundred commas if I want
> >> to pass in a value for the 101st param.
> >>
> >> With name-value pairs I can include only the options I want, and in any
> >> order.
> >>
> >> Extra bonus points that the purpose of any argument is made explicit by
> >> including its name.  If I see "o" I don't need to count commas and guess
> >> about what that applies to, I know very clearly looking at the name
> >> provided with it that it governs the plot type.
> >
> >
> > _______________________________________________
> > 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
> >
>
>
> _______________________________________________
> 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