Difference between revisions of "NameSpace copy"

From Wiki
Jump to: navigation, search
m (Description)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{command header|Namespace Commands}}
== nameSpace copy ==
+
'''Namespace commands'''
+
  
=== Synopsis ===
+
{{body|nameSpace copy {filter} {from <nowiki> | </nowiki> to} {local <nowiki> | </nowiki> global} {namespace name}|''(Added in 1.40)'' The '''[[Documentation#Namespace|Namespace]]''' copy command allows to copy all or part of variables within a [[Documentation#Namespace|Namespace]] into another. The {filter} parameter is use to specify which variables should be copied and accepts two special characters "?" and "*".
'''nameSpace''' copy {filter} {from | to} {local | global} {namespace name}  
+
 
+
=== Description ===
+
''(Added in 1.40)'' The '''[[Documentation#Namespace|Namespace]]''' copy command allows to copy all or part of variables within a [[Documentation#Namespace|Namespace]] into another. The {filter} parameter is use to specify which variables should be copied and accepts two special characters "?" and "*".
+
  
 
The "?" character matches any single character and can be use multiple times within one {filter} expression. I.e. "return?" will match any variable whose name start with "return" and has one additional character.
 
The "?" character matches any single character and can be use multiple times within one {filter} expression. I.e. "return?" will match any variable whose name start with "return" and has one additional character.
Line 13: Line 7:
 
The "*" character matches zero or more unspecified character. It can only appear but once within a {filter} expression. I.e. "return*" will match any variable whose name start with "return".
 
The "*" character matches zero or more unspecified character. It can only appear but once within a {filter} expression. I.e. "return*" will match any variable whose name start with "return".
  
The {from | to} parameter defines the direction for the copy, while the {local | global} {namespace name} parameters define the [[Var nsname|name]] and scope of the [[Documentation#Namespace|Namespace]] to be used.
+
The {from <nowiki> | </nowiki> to} parameter defines the direction for the copy, while the {local <nowiki> | </nowiki> global} {namespace name} parameters define the [[NsName|name]] and scope of the [[Documentation#Namespace|Namespace]] to be used.
  
 
From: copies variables from the specified [[Documentation#Namespace|Namespace]] into the current [[Documentation#Namespace|Namespace]].
 
From: copies variables from the specified [[Documentation#Namespace|Namespace]] into the current [[Documentation#Namespace|Namespace]].
Line 19: Line 13:
 
To: copies variables from the current [[Documentation#Namespace|Namespace]] into the specified [[Documentation#Namespace|Namespace]]. If the specified [[Documentation#Namespace|Namespace]] doesn't exist at this time, it will be created.
 
To: copies variables from the current [[Documentation#Namespace|Namespace]] into the specified [[Documentation#Namespace|Namespace]]. If the specified [[Documentation#Namespace|Namespace]] doesn't exist at this time, it will be created.
  
The default [[Documentation#Namespace|Namespace]] is [[Documentation#Namespace local|local]] and named STD. This setting is restored when the script is stopped.
+
The default [[Documentation#Namespace|Namespace]] is [[Documentation#Namespace local|local]] and named STD. This setting is restored when the script is stopped.}}
  
  
{{Note|Currently only Local scope is available. Global scope is to be introduced in a future version of EasyUO.}}
+
{{Note|Global namespaces are only available in EasyUO 1.5.}}
 
+
  
 
==== Example ====
 
==== Example ====
Line 43: Line 36:
 
return</pre>
 
return</pre>
  
=== See Also ===
+
 
{|
+
=See Also=
| Width=200px | [[nameSpace local]] || Width=200px | [[nameSpace clear]] || Width=200px | [[nameSpace global]] || Width=200px | [[nameSpace push]] || Width=200px | [[nameSpace pop]] || Width=200px | [[Var nsType|#nsType]] || Width=200px | [[Var nsName|#nsName]]
+
{{Namespace}}
|}
+
----
+
{|
+
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px |
+
[[Documentation#Namespace|Namespace]]
+
|}
+

Latest revision as of 12:25, 13 September 2007


Synopsis

nameSpace copy {filter} {from | to} {local | global} {namespace name}

Description

(Added in 1.40) The Namespace copy command allows to copy all or part of variables within a Namespace into another. The {filter} parameter is use to specify which variables should be copied and accepts two special characters "?" and "*".

The "?" character matches any single character and can be use multiple times within one {filter} expression. I.e. "return?" will match any variable whose name start with "return" and has one additional character.

The "*" character matches zero or more unspecified character. It can only appear but once within a {filter} expression. I.e. "return*" will match any variable whose name start with "return".

The {from | to} parameter defines the direction for the copy, while the {local | global} {namespace name} parameters define the name and scope of the Namespace to be used.

From: copies variables from the specified Namespace into the current Namespace.

To: copies variables from the current Namespace into the specified Namespace. If the specified Namespace doesn't exist at this time, it will be created.

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

set !return ; make sure !return is empty
gosub test
display ok !return
halt

sub test
	nameSpace Push ; saves current namespace
	nameSpace Local Test ; create a new temporary namespace to work with
	set !return this_is_a_test
	nameSpace Pop ; restore previous namespace
	nameSpace Copy ret* From Local Test ; copy variables to the original namespace
	nameSpace Push ; saves current namespace
	nameSpace Local Test
	nameSpace Clear ; free memory used by temporary namespace
	nameSpace Pop ; restore previous namespace
return


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