|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > STK. - Stack > STK.-Management > Stack Management Commands |
MiniRobotLanguage (MRL)
STK.GetType|$$STK[|$$TYP]
Get the data type of the stack.
Intention
The STK.GetType command retrieves the type of data stored in the stack. This helps ensure that operations performed on the stack are consistent with the data type.
The command returns the following values:
1 - String
2 - Integer
3 - Extended (Float)
0 - Error
If the optional parameter $$TYP is provided, the result will be stored there.
Syntax
STK.GetType|$$STK[|$$TYP]
Parameter Explanation
P1 - $$STK: The stack handle whose data type is to be retrieved.
P2 - $$TYP (Optional): A variable to store the result of the operation. If omitted, the result is returned to the top of the stack.
Example
'***********************************
' Example 1: Get Type of a Stack
'***********************************
STK.New|$$STK|s
STK.GetType|$$STK|$$TYP
JIV.$$TYP!1|Lab_Failed
STK.End|$$STK
ENR.
'***********************************
' Example 2: Get Type Without Variable
'***********************************
STK.New|$$STK|i
STK.GetType|$$STK
STK.Peek|$$STK|$$RES
JIV.$$RES!2|Lab_Failed
STK.End|$$STK
ENR.
Remarks
- The command ensures type safety by verifying the data type of the stack.
- If the stack handle is invalid, the command returns 0 (Error).
Limitations:
- The stack handle must be valid before calling STK.GetType. Invalid handles will return an error.
See also:
• STK.New
• STK.End