Condtional parameters in handler calls

Peter Haworth pete at lcsql.com
Tue Jul 17 20:54:58 EDT 2012


Thanks everyone for the alternative ways of doing this.  I think Mike's
comes closest to what I was hoping for.  It was pretty much an academic
question. I still think it would be nice to be able to do it though.

Pete
lcSQL Software <http://www.lcsql.com>



On Tue, Jul 17, 2012 at 4:35 PM, Mike Bonner <bonnmike at gmail.com> wrote:

> How about something like this?
>
> command myCommand parm1,parm2,parm3
>    put parm1 && parm2 && parm3
> end myCommand
>
> function myFunc parm1,parm2,pConditional
>    if value(pConditional) then
>       return parm1
>    else
>       return parm2
>    end if
> end myFunc
>
> on mouseup
>    myCommand 14,myFunc(3,22,"parm1 < parm2"),35
> end mouseup
>
>
> Same answer as Dick Kriesel.  :) Works nicel though.  Pass 2 params and a
> conditional string to the function, function does the processing, returns 1
> of the 2 based on the conditional.
>
>
> On Tue, Jul 17, 2012 at 5:29 PM, Kee Nethery <kee at kagi.com> wrote:
>
> > if <condition> then
> >         put <parm2a> into parm2
> > else
> >         put <parm2b> into parm2
> > end if
> >
> > myCommand parm1, parm2, parm3
> >
> > I don't think it is possible and ... I think you are heading towards the
> > single line Perl programming contest where they see who can write a
> single
> > line of Perl that does something amazing and cannot be interpreted by a
> > human.
> >
> > Just my two cents.
> >
> > Kee Nethery
> >
> >
> > On Jul 17, 2012, at 4:18 PM, Peter Haworth wrote:
> >
> > > I'm pretty sure this is not possible but it would be very cool if a
> > > parameter to a command could be a conditiion something like:
> > >
> > > myCommand parm1,if <condition> then <parm2a> else <parm2b>,parm3
> > >
> > > I've tried every which way to do that but always get compile errors.
> > >
> > > Not possible, right?
> > >
> > > Pete
> > > lcSQL Software <http://www.lcsql.com>
> > > _______________________________________________
> > > 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
> >
> _______________________________________________
> 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