Jump to content

Module:TrimArray: Difference between revisions

From PanEcoDevWiki
No edit summary
No edit summary
 
Line 3: Line 3:
function p.links(frame)
function p.links(frame)
     local input = frame.args[1] or ""
     local input = frame.args[1] or ""
     local form = frame.args.form or "Mineral"
     local form = frame.args.form  
     local out = {}
     local out = {}


Line 15: Line 15:
     end
     end


     return table.concat(out)
     return table.concat(out </br>)
end
end


return p
return p

Latest revision as of 20:38, 28 October 2025

local p = {}

function p.links(frame)

   local input = frame.args[1] or ""
   local form = frame.args.form 
   local out = {}
   for item in mw.text.gsplit(input, ",", true) do
       local trimmed = mw.text.trim(item)
       if trimmed ~= "" then
           table.insert(out, string.format(
               '%s
', form, trimmed )) end end
   return table.concat(out 
)

end

return p