Table of Contents
The Storyboard Lua API (Lua API) gives developers access to the Engine though a Lua scripting interface. This API is a library of functions which allow interaction with the Engine by manipulating data and working with events and user interface components. Through the Storyboard Lua API developers can:
Get and set data values from the model
Inject application events
Manipulate model objects such as controls/layers
Each Lua function invoked from the Storyboard is passed two arguments:
script_function_name( table mapargs, string allargs)
The first argument, mapargs, is a Lua table whose keys provide the context in which the action is being invoked along with any action specific argument and parameters. This context includes the application, screen and control the action was associated with, the currently focused control, any arguments provided to the action as well as all of the event data that cause the action to fire.
The following keys are always available inside the context’s table:
The application context of the current action
The screen context of the current action (the current screen)
The layer context of the current action (the current layer)
The control context of the current action (the current control)
If the context_control is a Table then this is the row index of the current cell
If the context_control is a Table then this is the column index of the current cell
The current context (app, screen, layer, or control) that the event was targeted at
The name of the event the triggered the action
A pointer to a Lua table containing any event data. The event data is different for each event and is defined in the event definition.
The second argument, allargs, provides a string containing the exact same string that was provided to the data arguments of the action.
Example of using context data:
function get_context( mapargs, stringargs ) print("triggered by event : "..mapargs.context_event) print("event was targeting : "..mapargs[mapargs.context_target]) print("stringargs : ", stringargs) end