IDOL 12.13

# Write Lua Scripts

A Lua script that is run by CFS 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.

To continue processing the document, the `handler` function must return `true`. If the function returns `false`, the document is discarded.

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

After you have written a Lua script, you must set up an import task or index task A processing task run by CFS on documents. Update-index tasks run when a document's metadata (but not its content) is updated. Delete-index tasks run when a document is deleted from a repository. to run it. Import tasks and index tasks are defined in the CFS configuration file.

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.13 | Last updated October 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 12.13

Topic Title: Write Lua Scripts