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. -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 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