Creation/Dev/GScript/Constants: Difference between revisions
From Graal Bible
(Creation) |
No edit summary |
||
Line 9: | Line 9: | ||
A constant may be used most likely to keep a variable that is available to any script from changing its value due to any foreign script interfering. | A constant may be used most likely to keep a variable that is available to any script from changing its value due to any foreign script interfering. | ||
A constant is only accessible in the script where you have defined it, they | |||
are not shared between the server-side and client-side parts either. | |||
{{stub}} | {{stub}} |
Revision as of 03:03, 10 May 2006
As one might be able to deduce, a constant has a single value and will retain that value as long as that constant exists. A constant is not a variable for one very important reason: it's value is not variable!
const intVar = 3; intVar = 4; player.chat = intVar; // displays 3
The value of the constant cannot change even in conjunction with the use of the "=" operator. This is the power of a constant. However, player.variables cannot be defined as a constant (client(r).variables, too, possibly).
A constant may be used most likely to keep a variable that is available to any script from changing its value due to any foreign script interfering.
A constant is only accessible in the script where you have defined it, they are not shared between the server-side and client-side parts either.
This article is a stub - an incomplete placeholder article that gives some idea of what is being talked about, but fails to adequately elaborate on the given subject. Feel free to help GraalBible by expanding upon it.