Hi Andrew,
In HyperCard, global variables can be defined inside handlers only,
while in LiveCode they can also be defined outside handlers.
In LiveCode, a global variable defined inside handlers is only available
to those handlers, while a global variable defined outside a handler is
available to all handlers in the current script.
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage:
http://economy-x-talk.comTwitter:
http://twitter.com/xtalkprogrammerKvK: 50277553
Installer Maker for LiveCode:
http://qery.us/468Buy my new book "Programming LiveCode for the Real Beginner"
http://qery.us/3fiLiveCode on Facebook:
https://www.facebook.com/groups/runrev/On 7/13/2014 14:40, andrewferguson500@[redacted].com[HyperCard] wrote:
>
>
> Hello everyone,
>
> I was playing with HyperCard today, and I discovered something that
> puzzled me. As a user of LiveCode, I am used to putting "global" at the
> top of my script, before any handlers. For example:
>
>
> global myVariable
>
> on mouseDown
>
> put "HyperCard" into myVariable
>
> end mouseDown
>
>
> on mouseUp
>
> answer myVariable
>
> end mouseUp
>
>
> In LiveCode, this script would answer "HyperCard". However in HyperCard,
> it does not.
>
> "The Complete HyperCard 2.0 Handbook" explains that a solution would be
> to use this:
>
>
> on mouseDown
>
> global myVariable
>
> put "HyperCard" into myVariable
>
> end mouseDown
>
>
> on mouseUp
>
> global myVariable
>
> answer myVariable
>
> end mouseUp
>
>
> This seems unusual to me. Is this correct? Or is there some other way to
> get my first script to work in HyperCard?
>
>
> Thanks,
>
> Andrew