Gazelle 22 "Left Arrow Script" ------------------------------ "Left arrow script" is one of Gazelle 22's two scripting languages. It is the powerful one of the two. It can do anything Java can do except for defining classes or lambdas. -Usually, you write one command per line -Each command contains at most one action and at most one assignment -The language is case-sensitive -You can add comments like in Java with /* */ or // -You can write multiple commands in one line by separating them with a semicolon -Arguments to functions are separated by spaces -You can use integer and string literals like in Java -You can use true, false and null It's called "left arrow script" because the left arrow (variable assignment) is its only actual operator (not counting ; and {}). Operations ---------- You can call any global function defined in Gazelle. Example: infoBox "hello" // show a popup with the text "hello" You can assign the result of a function call to a variable: time <- tsNow // get current time as a Timestamp object infoBox time // show as popup Note that this script requires 2 lines because only one operation is allowed per command. Variables can be overwritten and don't have to be declared. Creating objects ---------------- You can create an instance of any Java class and call methods on the object: list <- new ArrayList list add "hello" list add "world" infoBox list // shows [hello, world] (Currently you can also say "list <- ArrayList", but this is ambiguous and may be removed in a future version.) You can pass parameters to the constructor: pair <- new Pair "hello" "world" infoBox pair // shows <hello, world> Java operators (+, * etc) ------------------------- Java operators can't be used directly but we have functions that do the same thing (if we don't, we'll add them): x <- plus 1 2 infoBox x Function definitions -------------------- You can define functions in your script, with arguments. The function can return a value (which is the result of the last command in the function). def doubleMe x { mul x 2 } x <- doubleMe 5 infoBox x // shows 10
Began life as a copy of #1033775
Travelled to 6 computer(s): bhatertpkbcr, ekrmjmnbrukm, elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1034045 |
Snippet name: | Gazelle 22 "Left Arrow Script" Help |
Eternal ID of this version: | #1034045/5 |
Text MD5: | 792fee82302f3d62463a745bae1aa54e |
Author: | stefan |
Category: | javax / gazelle v |
Type: | Document |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-18 17:40:51 |
Source code size: | 2254 bytes / 70 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 126 / 696 |
Version history: | 4 change(s) |
Referenced in: | #1034022 - JLeftArrowScriptIDE #1034363 - JLeftArrowScriptIDE (backup with two status bars) #1034729 - JLeftArrowScriptIDE backup #1034955 - JLeftArrowScriptIDE backup |