Connector Framework Server 12.12

# Write a Lua Script

Your Lua script must have the following structure:

    function handler(document)
       ...
    end

The `handler` function is called for each document and is passed a document object. The document object is an internal representation of the document being processed. Modifying this object changes the document.

For CFS to continue processing the document, the function must return `true`. If the function returns `false`, the document is discarded.

The script can also terminate due to an error, for example if you use the Lua `error` function or call a Lua function that causes an error. In this case CFS continues to process the document, but places an error message in the `ImportErrorDescription` field.

TIP: You can write a library of useful functions to share between multiple scripts, which you can then include in the scripts by adding `dofile("library.lua")` to the top of the lua script outside of the `handler` function.

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 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 Connector Framework Server 12.12

Topic Title: Write a Lua Script