Module:ImageGridFromList: Difference between revisions

From The First Descendant Wiki
(Created page with "local p = {} function p.split(frame) local str = frame.args[1] local sep = frame.args[2] local pre = frame.args[3] local result = {} for match in (str..sep):gmatch("(.-)"..sep) do table.insert(result, pre .. match) end return table.concat(result, "\n") end return p")
 
m (Software2 moved page Module:String to Module:ImageGridFromList without leaving a redirect)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
     local str = frame.args[1]
     local str = frame.args[1]
     local sep = frame.args[2]
     local sep = frame.args[2]
    local pre = frame.args[3]
     local result = {}
     local result = {}
     for match in (str..sep):gmatch("(.-)"..sep) do
     for match in (str..sep):gmatch("(.-)"..sep) do
         table.insert(result, pre .. match)
         table.insert(result, '<div class="image-item">[[File:' .. match .. '|200px]]</div>')
     end
     end
     return table.concat(result, "\n")
     return table.concat(result, "\n")
end
end


return p
return p

Latest revision as of 17:40, 1 June 2024

Documentation for this module may be created at Module:ImageGridFromList/doc

local p = {}

function p.split(frame)
    local str = frame.args[1]
    local sep = frame.args[2]
    local result = {}
    for match in (str..sep):gmatch("(.-)"..sep) do
        table.insert(result, '<div class="image-item">[[File:' .. match .. '|200px]]</div>')
    end
    return table.concat(result, "\n")
end

return p