Definable Lua Functions Overview
The Lua scripts can define any subset of the functions described below. The functions are separated into 4 groups:
- CONFIG. Functions called once to configure basic settings to apply to all feeds for the task.
- FEEDURL. Functions relating to constructing and downloading URLs.
- FEED. Functions for processing a feed by identifying the entries and handling paging.
- ENTRY. Functions for extracting content from an entry.
The CONFIG and FEEDURL functions take no arguments (except for [prefix_]postProcessDownload)
.
All FEED functions take a LuaXmlDocument
as a single argument, this provides functions xml:XPathExecute
, xml:XPathValues
and xml:XPathValue
for manually extracting content from the XML.
All ENTRY functions take a LuaXmlDocument
and also a Document
. The Document
provides all normal functions like document:setFieldValue
and document:appendContent
.
Most of the functions can have an optional prefix to the function name that can be used to indicate the type of feed the functions can apply to. These functions are defined below with names in the format "[prefix_]functionName
". A prefix defined as "myPrefix" would result in function names like "myPrefix_functionName
". Where no prefix is defined, the function "functionName
" would be called.
Where a prefix is in play, only functions with a matching prefix will be called (except for postProcessDownload
).
A prefix can become in play for a feed or entry if a function returned a URL or XPath assigned to that prefix; any function calls relating to the URL or XPath would use this prefix.