Module:Utils

local p = {};

function p.toTable(s,delimiter1,delimiter2) local result = {}; delimiter1 = delimiter1 or ','; delimiter2 = delimiter2 or '\\='; local ind = ''; for match1 in (s..delimiter1):gmatch("(.-)"..delimiter1) do   	for match2 in (match1..delimiter2):gmatch("(.-)"..delimiter2) do    		if ind == '' then ind = match2; else result[ind] = match2; ind = ''; end end end return result; end

function p.toNumberedTable(s, delimiter1) local result = {}; delimiter1 = delimiter1 or '/'; for match1 in (s..delimiter1):gmatch("(.-)"..delimiter1) do   	table.insert(result, match1); end return result; end

function p.trimBrackets(s) local ls = string.gsub(s,"%[",''); local rs = string.gsub(ls,"%]",''); return rs; end

return p