Module:EnumValues

From Resonite Wiki

This module is used by the implementation of Template:Table EnumValues


-- test in console:
-- =p.main(mw.getCurrentFrame():newChild{title="Template:Table EnumValues",args={"Left", "1", "Left"}}:newChild{title="Module:Test",args={}})

local p = {}

function p.main(frame)
	local body = ""
	
	local templateFrame = frame:getParent()
	local i = 0

	while true do
		local argI = i * 3 + 1
		local name = templateFrame.args[argI]
		local value = templateFrame.args[argI + 1]
		local description = templateFrame.args[argI + 2]

		if name == nil then
			break
		end

		description = mw.text.trim(description)

		body = body.."|-\n"
		body = body.."|<code id=\""..name.."\">"..name.."</code>\n"
		body = body.."|"..value.."\n"
		body = body.."|"..description.."\n"
		i = i + 1
	end
	
	return body
end

return p