Module:AeroWikiListTools: Difference between revisions
From Aeronautica Official Wiki
More actions
Sqwishyish (talk | contribs) debugging split_list function |
Sqwishyish (talk | contribs) m debugging split_list function |
||
Line 5: | Line 5: | ||
if type(input_string) == table then | if type(input_string) == table then | ||
table.concat(input_string, '') | input_string = table.concat(input_string, '') | ||
end | |||
for split in string.gmatch(input_string, '([^, ]+)') do | for split in string.gmatch(input_string, '([^, ]+)') do | ||
new_string = new_string .. template:gsub('{split}', split) .. ', ' | new_string = new_string .. template:gsub('{split}', split) .. ', ' | ||
end | end | ||
return new_string:sub(1, -3) | return new_string:sub(1, -3) | ||
end | end | ||
return p | return p |
Revision as of 06:52, 29 April 2025
Documentation for this module may be created at Module:AeroWikiListTools/doc
local p = {}
p.split_list = function (input_string, template)
local new_string = ''
if type(input_string) == table then
input_string = table.concat(input_string, '')
end
for split in string.gmatch(input_string, '([^, ]+)') do
new_string = new_string .. template:gsub('{split}', split) .. ', '
end
return new_string:sub(1, -3)
end
return p