Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
aql:stack_example_b [2020/01/03 03:13]
optrix created
aql:stack_example_b [2020/01/03 03:24] (current)
optrix
Line 1: Line 1:
 ====Script Execution Example Page 2==== ====Script Execution Example Page 2====
  
 +After the last page, our stack and code looked like this...
  
 +^Stack^Code^
 +|TE101 //​[Constant]//​|ASSET //​[Command]//​|
 +
 +Now, it's time to copy the next line from **code** to the **stack**.
 +
 +However, this time it's a **command** - rather than these being copied directly onto the stack, it's //​executed//​ instead.
 +
 +A command will almost always '​eat'​ one or more //​parameters//​ off the stack. In this case, the **ASSET** command will eat a single item from the stack - the name of the asset it needs to search for.
 +
 +^Stack^Code^
 +| //Running: **ASSET ( TE101 )**// | |
 +
 +A command may optionally add items to the stack as well. In this case, it will leave an [[asset list]] on the stack, containing a single asset with the best matching name.
 +
 +^Stack^Code^
 +| AssetList [ { id: 203, name: "​Temperature Sensor #1", ern: "​TE101"​ } ] | |
 +
 +And now our script has reached its end. As a result, we have the name, ern and ARDI ID of the asset //​Temperature Sensor #1//, which has ERN number TE101.
 +
 +----
 +
 +The key to the system though is how you can chain commands together to create complex results. What if we wanted to know the value of a particular property for this asset? Or find out which properties were available for it?
 +
 +In [[stack_example_c|page 3]], we will see how we can keep the stack going to ask more interesting questions.