8,756
edits
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 |