Engine:CCMD context: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{dev/uiccmd}} Switches contexts or prints the current context. <kua>context client</kua> == Arguments == * name (optional) - The name of the context to switch to. If no name, then prints the name of the current context. == Details == The 'context' command allows changing between named contexts. A context can be thought of as a discrete place where commands can be executed. Each context may have its own commands and variables and rules, and purpose. For a different co...") |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
== Arguments == | == Arguments == | ||
* name (optional) - The name of the context to switch to. If no name, then prints the name of the current context. | * name (optional) - The name of the context to switch to. If no name, then prints the name of the current context. | ||
== Associations == | |||
* Is available in all contexts. | |||
== Details == | == Details == | ||
The 'context' command allows changing between named contexts | The 'context' command allows changing between named contexts. Each context may have its own commands and variables and rules, and purpose. | ||
For a | For a context to be available, it has to be associated with the one you are in. These associations are created by the various engine modules and can never be directly added or removed by console commands, or any type of script or AddOn. | ||
Although doesn't involve the 'context' command, context names can also be used to reference facilities in other contexts directly, rather than by switching first. | |||
== Examples == | == Examples == | ||
Line 23: | Line 28: | ||
global | global | ||
</kua> | </kua> | ||
* Same as the first example, | === Context separation === | ||
* Same as the first example. But change to the known 'client' context, which is addressable from the 'global' context. | |||
<kua> | |||
> context client | |||
</kua> | |||
* Start the client service, and change the client 'bob' variable which exists only in the 'client' context. | |||
<kua> | |||
> start | |||
Client started. | |||
> bob 8081 | |||
> bob | |||
'bob' is '8081' | |||
> context | |||
client | |||
</kua> | |||
* Change back to the 'global' context. Test to see that the bob variable in 'client' is not in 'global'. | |||
<kua> | |||
> context global | |||
> context | |||
global | |||
> bob | |||
Unknown: bob | |||
</kua> | |||
=== Without switching === | |||
In these examples a context is addressed directly without using the context command. | |||
* Show current context. | |||
<kua> | <kua> | ||
> | > context | ||
global | |||
</kua> | |||
* Start the client service directly from global without switching. | |||
<kua> | |||
> client start | |||
Client started. | |||
</kua> | </kua> | ||
* | * Set the 'bob' variable in client, check its value in 'client', and verify it's not in 'global'. | ||
<kua> | <kua> | ||
> | > client bob 8081 | ||
> | > client bob | ||
'bob' is ' | 'bob' is '8081' | ||
> bob | |||
Unknown: bob | |||
</kua> | </kua> | ||
== Notes == | == Notes == | ||
* | * |
Latest revision as of 18:42, 15 October 2023
Switches contexts or prints the current context.
context client
Arguments[edit]
- name (optional) - The name of the context to switch to. If no name, then prints the name of the current context.
Associations[edit]
- Is available in all contexts.
Details[edit]
The 'context' command allows changing between named contexts. Each context may have its own commands and variables and rules, and purpose.
For a context to be available, it has to be associated with the one you are in. These associations are created by the various engine modules and can never be directly added or removed by console commands, or any type of script or AddOn.
Although doesn't involve the 'context' command, context names can also be used to reference facilities in other contexts directly, rather than by switching first.
Examples[edit]
Default values[edit]
- Try to change to a non-existent context.
> context bob Unknown: bob
- Called with no name. The current context is printed.
> context global
Context separation[edit]
- Same as the first example. But change to the known 'client' context, which is addressable from the 'global' context.
> context client
- Start the client service, and change the client 'bob' variable which exists only in the 'client' context.
> start
Client started.
> bob 8081
> bob
'bob' is '8081'
> context
client
- Change back to the 'global' context. Test to see that the bob variable in 'client' is not in 'global'.
> context global > context global > bob Unknown: bob
Without switching[edit]
In these examples a context is addressed directly without using the context command.
- Show current context.
> context global
- Start the client service directly from global without switching.
> client start Client started.
- Set the 'bob' variable in client, check its value in 'client', and verify it's not in 'global'.
> client bob 8081
> client bob
'bob' is '8081'
> bob
Unknown: bob