setlocal
- Last UpdatedMay 02, 2023
- 2 minute read
The setlocal statement changes a local value inside a Command node.
Important This statement is deprecated. We advise you to use the set statement instead of the legacy setfield and setlocal, as set works for both locals and fields. This makes the code more readable. Contrary to what setfield does, set resolves the parameters only once, which allows it to perform operations on types that might contain reserved characters, such as SJSON and others.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Code example
This is a code example for the setlocal statement.
<command name="updateFlow">
<local name="idx" type="sint" value="0">
<while condition="@%idx%@<10">
<!-- ... -->
<setlocal name="idx" value="#@%idx%@+1#" />
</while>
</command>
Fields
These are the fields for setlocal statement.
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
condition |
sstring |
Optional |
No default value |
Determines whether the local value assignment is executed. |
|
name |
sstring |
Mandatory |
No default value |
The reference name of the local field. |
|
value |
sstring |
Mandatory |
No default value |
The new value to set for the local. |