Testing for numerics

Ken Ray kray at sonsothunder.com
Mon Oct 9 22:04:04 EDT 2006


On 10/9/06 8:46 PM, "Jim Ault" <JimAultWins at yahoo.com> wrote:

> On 10/9/06 3:06 PM, "Ken Ray" <kray at sonsothunder.com> wrote:
> 
>> You're right, of course - there's no way to just declare a global and then
>> later try and tell the difference between it being newly declared and it
>> having had "empty" put into it.
> 
> Ken,
> 
> I beg to differ, but perhaps I don't know enough about globals in Rev
>  Globals are in the Rev space, owned by Rev, and will persist even if all
> stacks are closed and removed from memory... however
> 
> global gVar2
> on mouseUp
>    breakpoint
>   --gVar2 appears in Variable Watcher, but not in (the globals)

Cool! I didn't know that this happened... this might be quite useful.

Thanks for the info!

> PS.  Environmental globals have to be declared to be used, as well.

Actually, they don't - they just need to be used. Try this - make a new
stack with 2 buttons. Set the script of the first one to:

on mouseUp
  put 10 into $Test
end mouseUp

Set the script of the second one to:

on mouseUp
  put $Test
end mouseUp

Click both buttons in sequence - you get "10" showing up in the message
box... so no declarations are necessary, you just use them.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list