Getting Started > Use Lua Scripts > Use Lua Scripts within the CFS > Write a Lua Script

Write a Lua Script
The script should have this structure:
function handler(document)
The handler function is called for each document and is passed a document object. This is an internal representation of the document being processed. Modifying this object will change the document.
Return true if you want to continue processing the document and return false if you want to stop.
NOTE 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.