Using return in a command script

Mike Kerner MikeKerner at roadrunner.com
Wed Oct 26 16:37:32 EDT 2016


just for the heck of it change the variable to a global so you can track it
inside and out of the handler, and see what happens.

On Wed, Oct 26, 2016 at 4:30 PM, Bob Sneidar <bobsneidar at iotecdigital.com>
wrote:

> Very odd. Doesn't matter if I enclose in quotes I get the same result,
> only now I am seeing that if I call the handler that returns the value from
> the message box it works fine! So here's what I am trying to do. When I
> open a stack for the first time, I go to a Database Setup card. This card
> has an Opencard handler that handles the database initialization for the
> stack. If it's the first time there, I call a handler which stores a value
> in a script local variable, so the next time I open the Database Setup card
> for that session, I don't go through the whole Database Initialization all
> over again.
>
> Now if the initialization succeeds, I store true to a variable otherwise I
> store false. The last thing I do on the Opencard handler for the Database
> Setup card is I return the variable. If I put the result then breakpoint
> right after I return from that handler the result is empty!!!
>
> Clearly something in this process is setting the result to empty, and it
> probably has something to do with the navigation between cards. What I am
> doing instead is saving the value as a property of the mainstack, which I
> am doing more and more these days as a way of storing persistent values
> whose scope is the mainstack I am working with. Globals won't work because
> I often use a device like the database setup card in multiple projects
> which might be open simultaneously, and I don't want to walk on another
> stacks variables.
>
> So the exercise is academic I suppose. I'm sure that if I used return in a
> command that didn't actually go anywhere when I returned from it, the
> method would work fine. It just seems that using return in a command
> structure is fraught with peril, so I will just use object/card/stack
> properties instead.
>
> Bob S
>
>
> > On Oct 26, 2016, at 12:57 , Phil Davis <revdev at pdslabs.net> wrote:
> >
> > What happens if you return "false" instead of false? Still broken?
> > Phil Davis
> >
> >
> > On 10/26/16 12:45 PM, Bob Sneidar wrote:
> >> I'm using version 8.1.1 (I don't distribute apps compiled with a dev
> preview). I return false and immediately in the calling script check for
> the result. It is empty.
> >>
> >> Bob S
> >>
> >>
> >>> On Oct 26, 2016, at 11:44 , Richard Gaskin <ambassador at fourthworld.com>
> wrote:
> >>>
> >>> dunbarx wrote:
> >>>> Do you mean something like this does not work anymore???
> >>>>
> >>>> Impossible.
> >>>>
> >>>> on mouseUp
> >>>>   doThis
> >>>>   answer the result
> >>>> end mouseUp
> >>>>
> >>>> on doThis
> >>>>   return random(999)
> >>>> end doThis
> >>> Works here as of v9.0 dp 1.
> >>>
> >>> --
> >>> Richard Gaskin
> >>> Fourth World Systems
> >>> Software Design and Development for the Desktop, Mobile, and the Web
> >>> ____________________________________________________________________
> >>> Ambassador at FourthWorld.com                http://www.FourthWorld.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
> >>
> >
> > --
> > Phil Davis
> >
> >
> > _______________________________________________
> > 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
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list