<< Click to Display Table of Contents >> Navigation: 3. Script Language > Stack-Operations > Stack Commands |
MiniRobotLanguage (MRL)
POP. Command
POP variable from user stack, without resolution
Intention
Takes off the Top of the current User-Stack and trim left and right side, then put it into the Variable in P1.
Will resolve Variables which are on the stack.
Takes the TOS into the Variable behind POP. Counterpart to PUS., PUV. PSS., PNS., and PVS.- these will Push Variables onto Stack with different sorts of Variable-Resolution.
If you do not want the content to be trimmed, use POV. instead.
You can POP. any Stack Content into the variable.
While PVS. and PUS. explicitly does NOT resolve variables and special-folder, POP. PUV. PSS., PNS do just that.
To avoid Variable Resolution when taking things from the Stack, you can use instead of POP. you can use the POV.-Command the following code with VAO. and $$000.
VAO.$$VAR=$$000
PVS. - Put Variable-Name on Stack without resolving anything
PSS. - Resolve Variables and Special-Folders before putting the Variable on Stack
PNS. - Do a numerical resolution and calculate Formulas in the Variable (if they are in ()). Then put the result on TOS.
PUV. - Do a Variable-Type dependent Variable resolution. Variables that are defined in some way have a Variable-Type (See GVT.-Command)
PUS. - Put Variable-Name on Stack without resolving anything. Unlike PVS., Variables will not be split if separated with |"|". Just the whole Parameter will be placed on TOS.
You can try this Script and see the stack and the return.
$$LAA="Hallo Ihr"
PVS.Hallo|$$LAA|$$LAA
DMP.6
POP.$$TXT
DMP.6
LEN.$$TXT|$$LEN
PRT.Length of TXT is: $$LEN
PRT.$$TXT
MBX.!
Syntax
POP.P1
Parameter Explanation
P1 - Variable that will take the result from TOS: The result will be trimmed and variables will be resolved.
If you omit the needed Parameter, POP. will set the timeout-flag and just continue to execute without doing anything.
POP. will only take 1 Parameter, if you need more use PUV.
The Stack being used is the actual User-Stack.
It can be the Local User Stack or the Global User-Stack, which depends on Settings done with STS.-Command.
If the Popped items are deleted from stack or not also depends on the Settings done with STS.
Please note, that Special Folders are resolved before Variables, therefore Special-Folders that may be unresolved inside Variables wont be touched.
Speed in Ticks:
This command uses typically around 90 Ticks.
Example
' Pop Variable from User-Stack (with resolution)
PRT.Items on Stack: #tos#
: $$TXA=Laba
: $$TXB=Lax
DBP. Variables Content (1): $$TXA-$$TXB
PUV.$$TXA|$$TXB
GSB.tos
POP.$$TXC
DBP.$$TXC
GSB.tos
MBX.Ready
END.
:tos
DMP.4
DBP. Items on Stack: #tos#
DBP. Item on TOS: <$dtos$>
RET.
Remarks
-
Limitations:
-
See also:
• STV. - Stack To/from Variable
• PUS. - Push Parameter onto Stack/Que
• PUV. PUsh variables on the User-Stack
• POV. - POp Variables from User-Stack