This article describes what functions and variables are available to scripts in the Map Script and Curve Script components. All Filter Forge API functions (but not variables) are syntax-highlighted with orange in the script editor.
Safe scripts (that is, scripts that have the Unsafe Script setting turned off in their Script Settings) are allowed to call Lua functions from the following standard Lua libraries:
Unsafe scripts are allowed to call all Lua functions from all standard Lua libraries.
The scripts in Filter Forge can employ several global variables that let you query the value of the global Size and Variation sliders, the width and height of the working image and more. When referencing these variables from scripts, remember that Lua is case-sensitive, so the variable names must be written in uppercase, as shown in the list:
Filter Forge provides functions allowing you to query values of custom inputs added to a Map Script or Curve Script component via the Input Editor. Each input type (e.g. Slider, Checkbox etc.) has a corresponding query function. For information on input types and their corresponding functions, see Referencing Inputs from Scripts.
Filter Forge provides a combine_aa_zones() function that simplifies the process of combining anti-aliasing zones. For more information on this function and on handling anti-aliasing in scripts in general, see Implementing Smart Anti-Aliasing.
Filter Forge provides a get_noise() and a set_noise_seed() functions that help implement any graphic algorithm that requires randomness. For more information on these functions and on using noise generation in scripts in general, see Noise API.
Filter Forge provides several blending functions like blend_normal(), blend_multiply() etc that help implement blending scripts. For more information on these functions and on using blending modes in scripts, see Blending Modes API.
You can use the standard Lua error() function to write error messages to the Message Log. Note that calling this function terminates the script. Currently, there are no other ways to send messages to the Message Log without interrupting the script.