Module:LocationMatch
From Gensopedia
More actions
Documentation for this module may be created at Module:LocationMatch/doc
local p = {}
-- Find which ch_x corresponds to the matching location_x
function p.findChapter(frame)
local args = frame.args
local needle = (args.location or ''):gsub('%[%[',''):gsub('%]%]','')
for i = 1, 6 do
local hay = (args['location_' .. i] or ''):gsub('%[%[',''):gsub('%]%]','')
if hay:find(needle, 1, true) then
return args['ch_' .. i] or ''
end
end
return 'Unknown'
end
return p