DKL9 GitList
Repositories
DKL9 home
memoire
Code
Commits
Branches
Tags
Search
Tree:
8b4c5d7
Branches
Tags
master
memoire
src
imgrefcheck.lua
Implement image reference check
John Smith
commited
8b4c5d7
at 2023-151 10:40:16
imgrefcheck.lua
Blame
History
Raw
local function fn(config, deck, deckfname) local mcl = {} for i, card in ipairs(deck) do for path in card[1]:spt():gmatch(IMG_PATTERN) do local fh = io.open((deckfname:match(".*/") or "") .. path, "r") if not fh then table.insert(mcl, i) break end end end if #mcl >= 1 then io.write(string.format("Found %d card%s with bad image references:\n", #mcl, #mcl == 1 and "" or "s")) else io.write(string.format("No cards with bad image references\n")) end for _, i in ipairs(mcl) do io.write(string.format("%d %s\n", i, deck[i][1]:spt())) end end return { desc = "(i)mage reference check", nd = true, fn = fn }