Module:List: Difference between revisions

From Vintage Story Wiki
(Created page with "local p = {} function p.list( f ) local args = f.args local listItems for k, v in pairs (args) do table.insert(listItems, '<li>' .. v .. '</li>') end local list = table...")
 
mNo edit summary
Line 2: Line 2:
function p.list( f )
function p.list( f )
local args = f.args
local args = f.args
local listItems
local listItems = {}
for k, v in pairs (args) do
for k, v in pairs (args) do
table.insert(listItems, '<li>' .. v .. '</li>')
table.insert(listItems, '<li>' .. v .. '</li>')

Revision as of 21:27, 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 listItems = {}
	for k, v in pairs (args) do
		table.insert(listItems, '<li>' .. v .. '</li>')
	end
	local list = table.concat(listItems, '\n')
	local html = {
		'<ol style="list-style-type: none; margin: 0; padding: 0;">',
			list,
		'</ol>'
	}
	return table.concat(html, '\n')
end
return p