forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal.lcdoc
More file actions
63 lines (43 loc) · 1.98 KB
/
global.lcdoc
File metadata and controls
63 lines (43 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Name: global
Type: command
Syntax: global <variableNameList>
Summary:
Declares a <global> <variable>.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
global gUserName
Example:
global gThisThing,gThatThing,gTheOtherThing
Parameters:
variableNameList:
A list of global variables separated by commas.
Description:
Use the <global> <command> to define a <variable> that can be used in
any <handler>, and which retains its <value> between <handler|handlers>.
You can place the <global> command either in a handler, or in a script
but outside any handler in the script:
* If you declare the global in a handler, the <global>
<declare|declaration> must appear in each <handler> in which you use
the <global>. If you <declare> a <global> in one <handler>, and try to
use it in another without first <declare|declaring> it in that
<handler>, the second <handler> treats it as a <local variable>, and
it does not retain its <value> between <handler|handlers>.
The <global> <command> can appear anywhere in a <handler>, as long as
it's before the first <statement> in which the <global|global variable>
is used. However, to make them easier to find, all <global>
<declare|declarations> are usually placed at the beginning of a
<handler> :
* If you declare a <global> <command> in a <script>, but outside any
<handler|handlers> in the <script>, the <global> can be used by any
<handler> that comes after the <global> <declare|declaration> in that
<script>. You don't need to declare such a <global> again in the
<handler> itself.
Such <global> <command|commands> are usually placed at the beginning of
the <script>, before any <handler|handlers>, to make them easy to find:
References: global (command), local (command), globalNames (function),
value (function), variable (glossary), handler (glossary),
global (glossary), statement (glossary), local variable (glossary),
declare (glossary), command (glossary), script (property)
Tags: properties