Media Server 12.11

# LuaScript

The Lua script that returns the rectangle(s).

Specify one of the following:

- the absolute path to the Lua script file.
- the path to the Lua script file, relative to the LuaDirectory.
- a string that matches one of your `AdditionalDataLabels`, (if you use the `AdditionalData` and `AdditionalDataLabels` action parameters to upload the Lua script file as part of the Process action).

TIP: If your script is relatively short, for example a single line, you can set the parameter `LuaLine` instead of `LuaScript`. The `LuaLine` parameter allows you to specify a small amount of Lua code directly in the configuration file, removing the need for a separate script file.

The Lua script must define a function named `rectangle`. The function takes a single argument, an input record, and must return either `nil` (to output nothing), a single rectangle (to produce one record corresponding to the input record), or an array of rectangles (to produce multiple records corresponding to the input record).

The following is an example Lua script that you could use to take a region that exists in the input records and add a new region that is 50 pixels further left and 50 pixels higher in the image:

    function rectangle(r)
        return { left=r.RegionData.left - 50, top=r.RegionData.top - 50,
                 width=r.RegionData.width, height=r.RegionData.height }
    end

The following example returns an array of rectangles:

    function rectangle(r)
        return {
            { left=r.RegionData.left - 50, top=r.RegionData.top - 50,
              width=r.RegionData.width, height=r.RegionData.height },
            { left=r.RegionData.left + 50, top=r.RegionData.top + 50,
              width=r.RegionData.width, height=r.RegionData.height }
        }
    end

If your Lua function returns `nil`, the task does not output any records for that input record.

Type: | String
Default: |
Required: | Yes
Configuration Section: | TaskName
Example: | `LuaScript=rectangle.lua`
See Also: |

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.11 | Last updated February 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Media Server 12.11

Topic Title: LuaScript