global

Typecommand
DictionaryLCS
LibraryLiveCode Script
Syntax
global <variableNameList>
Summary

Declares a global variable.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
variableNameList

A list of global variables separated by commas.

Example
global gUserName
global gThisThing,gThatThing,gTheOtherThing
RelatedProperty: script
Command: global, local
Function: globalNames, value
Glossary: variable, handler, global, statement, local variable, declare, command
Description

Use the global command to define a variable that can be used in any handler, and which retains its value between handlers.

You can place the global command either in a handler, or in a script but outside any handler in the script:

The global command can appear anywhere in a handler, as long as it's before the first statement in which the global variable is used. However, to make them easier to find, all global declarations are usually placed at the beginning of a handler :

Such global commands are usually placed at the beginning of the script, before any handlers, to make them easy to find:

Tagsproperties