Module:Utils

local p = {}

-- http://lua-users.org/wiki/StringTrim function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end

-- http://stackoverflow.com/questions/1426954/split-string-in-lua function split(inputstr, sep) if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gmatch(inputstr, "([^"..sep.."]+)") do       t[i] = str i = i + 1 end return t end

-- http://stackoverflow.com/questions/2705793/how-to-get-number-of-entries-in-a-lua-table function tablelength(table) local count = 0 for _ in pairs(table) do       count = count + 1 end return count end

function p.filetype( frame ) local str = frame.args[1] local stuff local spl = split(str, ',') local res = '' for key, value in pairs(spl) do       res = res .. ' '   end return frame:preprocess(res:sub(0, -7)) end

function p.test(frame) return frame.args[1] end

return p