Show Shared Functions
Just like in the Triggers window, if you start writing complex
expressions in your Show, you will find yourself repeating common
pieces of code over and over again in multiple expressions. The best
way to deal with that is to pull out the repetetive part and write it
as a function, which can then be called from any expression that wants
to use it. In Clojure, you use
defn to define a function, and
choosing brings up an editor window
that is where you should organize all of the shared functions you want
your Show expressions to use.
The Shared Functions will be loaded before any of your expressions are compiled.
If you are going to be using the functions only in Triggers
expressions, define them using
the Triggers window instead. Even though they get compiled into the
For a detailed (and amusing) look at defining and using shared functions in a show, check out the Break Buddy integration example.
Also see the discussion of how you can import libraries for use in your expressions.