Difference between revisions of "NameSpace global"

From Wiki
Jump to: navigation, search
(Example)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{command header|Namespace Commands}}
== nameSpace global ==
+
'''Namespace commands'''
+
  
=== Synopsis ===
+
{{body|nameSpace global {namespace name} |''(Added in 1.39)'' The '''[[Documentation#Namespace|Namespace]]''' global command defines the current [[Documentation#Namespace|Namespace]] name and scope. The {namespace name} must be a valid EasyUO name. The scope is global. A Global [[Documentation#Namespace|Namespace]] can be accessed by any script running within the same EasyUO instance.
'''nameSpace''' global {namespace name}  
+
  
=== Description ===
+
The default [[Documentation#Namespace|Namespace]] is [[Documentation#Namespace local|local]] and named STD. This setting is restored when the script is stopped.}}
''(Added in 1.39)'' The '''nameSpace''' local commands defines the current namespace name and scope. The {namespace name} must be a valid EasyUO name. The scope is global. A Global namespace can be accessed by any script running within the same EasyUO instance.
+
  
The default [[namespace]] is [[Namespace local|local]] and named STD. This setting is restored when the script is stopped.
 
  
''Note:''
+
{{Note|Global namespaces are only available in EasyUO 1.5.}}
''Currently '''only Local scope is available'''. Global scope is to be introduced in a future version of EasyUO.''
+
  
 
==== Example ====
 
==== Example ====
<pre>
 
namespace local ns1
 
set !test test1
 
  
namespace local ns2
+
EDIT on 2 feb. 2008: global nameSpaces are particularly useful when running
set !test test2
+
multiple scripts at the same time. To test these snippets copy/paste each one in a different
 +
page (run the first script, then the second, then the third to test). They MUST be wittin the same EUO instance though!!
  
namespace local ns3
+
first script:
set !test test3
+
<pre>
 +
nameSpace global test
 +
set !testMsg Vhann_was_here_to_show_ppl_how_to_use_global_namespaces
 +
pause
 +
</pre>
  
namespace local ns1
 
display ok !test
 
  
namespace local ns2
+
second script:
display ok !test
+
<pre>
 +
;Important: you MUST enter the nameSpace before you can access
 +
;the variables created in other scripts
 +
nameSpace global test
 +
display Ok !testMsg
 +
set !testMsg !testMsg , $you_can_use_globals_in_more_than_2_scripts_at_a_time.
 +
pause
 +
</pre>
  
namespace clear ns2
 
namespace local ns2
 
display ok !test
 
 
namespace local ns3
 
display ok !test
 
  
 +
Third script:
 +
<pre>
 +
nameSpace global test
 +
display Ok !testMsg
 
halt
 
halt
 
</pre>
 
</pre>
  
=== See Also ===
+
=See Also=
{|
+
{{Namespace}}
| Width=200px | [[nameSpace clear]] || Width=200px | [[nameSpace local]] || Width=200px | [[nameSpace push]] || Width=200px | [[nameSpace pop]] || Width=200px | [[nameSpace copy]] || Width=200px | [[Var nsType|#nsType]] || Width=200px | [[Var nsName|#nsName]]
+
|}
+
----
+
{|
+
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px |
+
[[Documentation#Namespace|Namespace]]
+
|}
+

Latest revision as of 12:17, 2 February 2008


Synopsis

nameSpace global {namespace name}

Description

(Added in 1.39) The Namespace global command defines the current Namespace name and scope. The {namespace name} must be a valid EasyUO name. The scope is global. A Global Namespace can be accessed by any script running within the same EasyUO instance.

The default Namespace is local and named STD. This setting is restored when the script is stopped.


Note: Global namespaces are only available in EasyUO 1.5.

Example

EDIT on 2 feb. 2008: global nameSpaces are particularly useful when running multiple scripts at the same time. To test these snippets copy/paste each one in a different page (run the first script, then the second, then the third to test). They MUST be wittin the same EUO instance though!!

first script:

nameSpace global test
set !testMsg Vhann_was_here_to_show_ppl_how_to_use_global_namespaces
pause


second script:

;Important: you MUST enter the nameSpace before you can access
;the variables created in other scripts
nameSpace global test
display Ok !testMsg
set !testMsg !testMsg , $you_can_use_globals_in_more_than_2_scripts_at_a_time.
pause


Third script:

nameSpace global test
display Ok !testMsg
halt

See Also

Namespace

  • Commands to interact with namespaces and their related variables.
nameSpace local Defines the current namespace and its scope
nameSpace global Defines the current namespace and its scope
nameSpace clear Clears every variables within the current namespace
nameSpace push Stores the current namespace name and scope
nameSpace pop Restores the current namespace name and scope
nameSpace copy Copy variables from one namespace to another