Weirdness with global variable declaration

Mark Wieder mwieder at ahsoftware.net
Mon Jan 19 12:05:28 EST 2004


Doug-

>>> global debugMode
>>> global inChatUsers, newChatSocket
>>> global chatRect, chatRectHalf, wbRect
>>> on openCard
>>> put "8,8,596,314" into chatRect

You're missing the point here. The global declarations are the only
thing outside the handler. the "put" statement is still *inside* the
openCard handler. Global declarations don't actually get executed, so
there's no question of when.

The difference is that in declaring the global variables outside of
the handler you're widening their scope, making them available to
everything in the current object, and removing the need to redeclare
them in each handler that might need them.

-- 
-Mark Wieder
 mwieder at ahsoftware.net



More information about the use-livecode mailing list