Module:Text Utility: Difference between revisions

Jump to navigation Jump to search
461 bytes added ,  20:26, 28 December 2019
readded splitargs
No edit summary
(readded splitargs)
 
Line 156: Line 156:
end
end


function p.splitArgs(input, fieldlist, sep)
    if not input or input == '' then return end
    sep = sep or '%s*;;;%s*'
    local result = {}
    local inputTbl = p.split(input,sep)
    for i, v in ipairs(fieldlist) do
        if not inputTbl[i] then
            error(('Missing parameter %s - maybe wrong child template?'):format(v))
        end
        if inputTbl[i] ~= '' then
            result[v] = inputTbl[i]
        end
    end
    return result
end
return p
return p

Navigation menu