|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > STK. - Stack > STK.-Import/Export > STK.Import and STK.Export |
MiniRobotLanguage (MRL)
STK.Export
Export the stack as a string (delimited or binary)
Intention
The STK.Export command is used to export the contents of a stack into a delimited string. Each element in the stack is converted to a string and concatenated with the specified delimiter. This is useful for saving or transferring stack data in a text format.
The default delimiter for integer (i) and float (f) data types is ;. For string (s) data types, the default delimiter is Binary, which uses a specialized delimiting system for binary data.
Syntax
STK.Export|P1|P2[|P3]
Parameter Explanation
P1 - The stack handle. This is typically a variable that contains the handle of the stack.
P2 - The delimiter used to separate the elements in the exported string. If omitted, the default delimiter is used based on the stack's data type.
If the stack type is "s" and P3 is omitted then "Binary" is used, which is the only way to pack binary data that may contain all 256 ASC Characters.
Binary is only available for Stacks with Type "s".
P3 - (Optional) The variable to store the exported string. If omitted, the result is placed on the Top of Stack (TOS).
Example
'***********************************
' STK.Export - Sample Script
'***********************************
' Create a new stack
STK.New|$$STK|s
' Push some values onto the stack
STK.Push|$$STK|Hello
STK.Push|$$STK|World
STK.Push|$$STK|Test
' Export the stack to a delimited string
STK.Export|$$STK|;|$$STR
DBP. Exported string: $$STR
' End the stack
STK.End|$$STK
ENR.
Remarks
-
Limitations:
-
See also:
• STK.New - Create a new stack
• STK.Push - Push a value onto the stack
• STK.Import - Import a string into the stack