\startmodule[ifchanged] \startluacode local collected = {} local tobesaved = {} local function initializer() -- this function is not called! -- print("<><><><><>",collected) collected = utilitydata.thirddata.ifchanged.collected end job.register('thirddata.ifchanged.collected', tobesaved, initializer) local function cachedmd5sum(filename) return collected[filename] or "" end function commands.doiffilechangedelse(filename) local md5sum = md5.HEX(io.loaddata(filename) or "") local cached = cachedmd5sum(filename) tobesaved[filename] = md5sum print(">>>>>>>>>>>>", md5sum) print("============", cached) commands.testcase(md5sum == cached) end \stopluacode \def\doiffilechangedelse#1% {\ctxcommand{doiffilechangedelse("#1")}} \def\doiffilechanged#1% {\doiffilechangedelse{#1}\firstofoneargument\gobbleoneargument} \def\doiffilenotchanged#1% {\doiffilechangedelse{#1}\gobbleoneargument\firstofoneargument} \stopmodule \starttext \doiffilechanged{test.pdf}{\executesystemcommand{context test}} \stoptext