what gives with this function?

J. Landman Gay jacque at hyperactivesw.com
Wed Jun 27 21:24:34 EDT 2007


Jim Lambert wrote:
> Hi All,
> 
> Here's a function that goes either in the card script or the stack script.
> 
> function whatGives what
>   return what
> end whatGives
> 
> Make a field "myFld"
> Make a button having this script:
> 
> on mouseUp
>   put whatGives(random(999)) into fld "myFld"
> end mouseUp
> 
> Click the button and random numbers appear in the field as expected.
> But call the function from the message box:
> 
> put whatGives(random(999)) into fld "myFld"
> 
> and lo! nothing gets put in the field however the value returned from 
> whatGives appears in the message box.
> Why isn't the returned value placed in the field?
> What gives?

I think it's just a limitation on single-line messages. Even if you 
split it up into two statements separated with a semicolon, it doesn't work:

  get whatGives(random(999)); put it into fld "myFld" -- fails

If you move it to the multi-line message box, the one-line statement 
above still doesn't work, but if you split it into two lines, it does:

  get whatGives(random(999))
  put it into fld "myFld"

The message box uses a "do" statement to execute its commands. As a 
guess, maybe there's a limitation on the number of nested functions the 
"do" command can handle simultaneously.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list