Module:List: Difference between revisions

From Vintage Story Wiki
mNo edit summary
mNo edit summary
 
(10 intermediate revisions by the same user not shown)
Line 2: Line 2:
function p.list( f )
function p.list( f )
local args = f.args
local args = f.args
local listItems = {}
local list = {}
for k, v in pairs (args) do
for str in string.gmatch(args[1], '([^;]+)') do
listItems[k] = '<li>' .. v .. '</li>'
table.insert(list, str)
end
end
local list = table.concat(listItems, '\n')
local listString = table.concat(list, '<br>')
local html = {
local html = {
'<ol style="list-style-type: none; margin: 0; padding: 0;">',
'<ol style="list-style-type: none; margin: 0; padding: 0;">',
list,
listString,
'</ol>'
'</ol>'
}
}

Latest revision as of 23:00, 17 August 2022

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

local p = {}
function p.list( f )
	local args = f.args
	local list = {}
	for str in string.gmatch(args[1], '([^;]+)') do
		table.insert(list, str)
	end
	local listString = table.concat(list, '<br>')
	local html = {
		'<ol style="list-style-type: none; margin: 0; padding: 0;">',
			listString,
		'</ol>'
	}
	return table.concat(html, '\n')
end
return p