Open topic with navigation

# 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 taskA 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.

© 2018 EntIT Software LLC, a Micro Focus company | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm