|  I didn't test this code at all, just copy pasted it, it's fine right 🙂 | 
| (No difference) | 
Revision as of 21:14, 27 February 2024
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
		body = body.."|-\n"
		body = body.."|<code>"..name.."</code>\n"
		body = body.."|"..value.."\n"
		body = body.."|"..description.."\n"
		i = i + 1
	end
	
	return body
end
return p
