FANDOM


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 .. '{{Fileinfo/type|' .. trim(value) .. '}}<br />'
    end
    return frame:preprocess(res:sub(0, -7))
end
 
function p.test(frame)
    return frame.args[1]
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.