Engine:CCMD var: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
Line 10: Line 10:
* 'var' called with 'bob' without a value. Variable 'bob' doesn't exist.
* 'var' called with 'bob' without a value. Variable 'bob' doesn't exist.
<kua>
<kua>
:var bob
> var bob
Unknown: bob
Unknown: bob
</kua>
</kua>
* Creates variable 'bob' and sets to 'fred'.  
* Creates variable 'bob' and sets to 'fred'.  
<kua>
<kua>
:var bob fred
> var bob fred
</kua>
</kua>
* Same as the first example, but now bob exists.   
* Same as the first example, but now bob exists.   
<kua>
<kua>
:var bob
> var bob
'bob' is 'fred'
</kua>
* Try to set 'bob' to 'james', but 'bob' is already set.
<kua>
> var bob james
> var bob
'bob' is 'fred'
'bob' is 'fred'
</kua>
</kua>

Revision as of 00:07, 14 October 2023

Console commands

Creates a new variable in the current context, if doesn't exist. If exists is ignored.

var bob fred

Arguments

  • name - name for new variable
  • value (optional) - the value to set. If no value, then prints value if exists

Examples

  • 'var' called with 'bob' without a value. Variable 'bob' doesn't exist.
> var bob
Unknown: bob
  • Creates variable 'bob' and sets to 'fred'.
> var bob fred
  • Same as the first example, but now bob exists.
> var bob
'bob' is 'fred'
  • Try to set 'bob' to 'james', but 'bob' is already set.
> var bob james
> var bob
'bob' is 'fred'

Notes