Module:PJB/TestComponentFields

From Resonite Wiki
Revision as of 14:43, 27 February 2024 by PJB (talk | contribs) (Testing lua-based Table ComponentFields)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

-- test in console:
-- =p.main(mw.getCurrentFrame():newChild{title="Template:Table ComponentFields",args={"FixTransformsEnabled", "Bool", "Clamps IK transforms to reasonable values and Resets IK every update."}}: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 type = templateFrame.args[argI + 1]
		local description = templateFrame.args[argI + 2]
		local typeString = templateFrame.args["TypeString"..i] or type

		if name == nil then
			break
		end

		body = body.."|-\n"
		body = body.."|<code>"..name.."</code>\n"
		body = body.."|'''[[Type:"..type.."|"..typeString.."]]'''\n"
		body = body.."|"..description.."\n"
		i = i + 1
	end
	
	return body
end

return p