Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

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