Module:LocationMatch
From Gensopedia
More actions
Documentation for this module may be created at Module:LocationMatch/doc
local p = {}
function p.findChapter(frame)
local args = frame.args
local needle = (args.location or ''):gsub('%[%[',''):gsub('%]%]','')
local out = {} -- collect debug lines
table.insert(out, 'Needle: ' .. needle)
for i = 1, 6 do
local hay = (args['location_' .. i] or ''):gsub('%[%[',''):gsub('%]%]','')
local ch = args['ch_' .. i] or ''
table.insert(out, string.format("%d → %s (ch %s)", i, hay, ch))
if hay:find(needle, 1, true) then
table.insert(out, 'MATCH → ' .. ch)
return table.concat(out, '<br>')
end
end
table.insert(out, 'No match found')
return table.concat(out, '<br>')
end
return p