Open topic with navigation

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

© 2016 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close We welcome your comments! 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 AutonomyTPFeedback@hpe.com. Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm