I'm working with a document for which I need to generate some data from a Lua script each time the PDF is produced. However, the generation of this data might be a slow, so I would like the script only to generate it from scratch when lualatex doesn't run in draft mode.
I wonder if there's something like this:
if tex.isRunningDraftMode() then print("USING OLD DATA") else generateDataFromScratch() end
Note that during the generation of the data, nothing is written to the document.