Question about Scope - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question about Scope (
/showthread.php?tid=207509)
Question about Scope -
LeNy - 06.01.2011
Hello.
What is the difference between a
static array of
new?
Re: Question about Scope -
veyron - 06.01.2011
thats what pawn language guide is for
• Static local declarations
A local variable is destroyed when the execution leaves the compound block
in which the variable was created. Local variables in a function only exist
during the run time of that function. Each new run of the function creates
and initializes new local variables. When a local variable is declared with
the keyword static rather than new, the variable remains in existence after
the end of a function. This means that static local variables provide private,
permanent storage that is accessible only from a single function (or
compound block). Like global variables, static local variables can only be
initialized with constant expressions.
• Static global declarations
A static global variable behaves the same as a normal global variable, except
that its scope is restricted to the file that the declaration resides in. To
declare a global variable as static, replace the keyword new by static.
Re: Question about Scope -
LeNy - 06.01.2011
That is, for example, as a function of creating a string[128]; better to use static?