Connector Framework Server 25.1
Connector Framework Server Help

# 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 2024 Open Text
Version 25.1 | Last updated January 2025

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 MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Connector Framework Server 25.1

Topic Title: Write a Lua Script