Engine:CCMD var: Difference between revisions
Jump to navigation
Jump to search
(→Notes) |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
{{dev/uiccmd}} | {{dev/uiccmd}} | ||
Creates a | Creates and sets a variable in the current context. | ||
<kua> | <kua>set bob fred</kua> | ||
== Arguments == | == Arguments == | ||
* name - name for | * name - name for variable to set | ||
* value (optional) - the value to set. If no value, then prints value if exists | * value (optional) - the value to set. If no value, then prints value if exists. | ||
== Details == | == Details == | ||
Can be used to set | Can be used to set values for variables. Will create a new variable is not exists. | ||
== Examples == | == Examples == | ||
=== Default values === | === Default values === | ||
* ' | * 'set' called with 'bob' without a value. Variable 'bob' doesn't exist. | ||
<kua> | <kua> | ||
> | > set bob | ||
Unknown: bob | Unknown: bob | ||
</kua> | </kua> | ||
* Creates variable 'bob' and sets to 'fred'. | * Creates variable 'bob' and sets to 'fred'. | ||
<kua> | <kua> | ||
> | > set bob fred | ||
</kua> | </kua> | ||
* Same as the first example, but now bob exists. | * Same as the first example, but now bob exists. | ||
Line 26: | Line 26: | ||
'bob' is 'fred' | 'bob' is 'fred' | ||
</kua> | </kua> | ||
* Try to set 'bob' to 'james', | * Try to set existing 'bob' to 'james', value changes. | ||
<kua> | <kua> | ||
> var bob james | > var bob james | ||
> var bob | > var bob | ||
'bob' is ' | 'bob' is 'james' | ||
</kua> | </kua> | ||
== Notes == | == Notes == | ||
* | * |
Revision as of 00:32, 14 October 2023
Creates and sets a variable in the current context.
set bob fred
Arguments
- name - name for variable to set
- value (optional) - the value to set. If no value, then prints value if exists.
Details
Can be used to set values for variables. Will create a new variable is not exists.
Examples
Default values
- 'set' called with 'bob' without a value. Variable 'bob' doesn't exist.
> set bob Unknown: bob
- Creates variable 'bob' and sets to 'fred'.
> set bob fred
- Same as the first example, but now bob exists.
> var bob
'bob' is 'fred'
- Try to set existing 'bob' to 'james', value changes.
> var bob james
> var bob
'bob' is 'james'