User:Trappingnoobs/EnumAutoformat.lua

--Use this script to print out wiki formatting for an enum.

--It only works with enums that go from 0 to highest number with no breaks. If there are, you'll need to manually adjust.
--To use, just change "eN" to the name of a valid enum. Add descriptions if possible. I recommend leaving the EmphasisBox, but you don't need to.

eN = "Axis"  
loadstring("En = Enum."..eN)()

print("{{EmphasisBox|This enum was generated by a script. Data may be incorrect.}}") 
print("<onlyinclude>")
print("{{Enum|The "..eN.." [[Enum]] has ".. #En:GetEnumItems() .. " numbers:|")   


function GetLastAfterDot(Str)
	--No need for patterns. :)
	local len = #("Enum."..eN..".")
	return Str:sub(len+1)
end

for index,enum in pairs(En:GetEnumItems()) do 
	local prtString = "{{Enum/row|"
	prtString = prtString .. index-1
	prtString = prtString .. "|"
	prtString = prtString .. GetLastAfterDot(tostring(enum))
	prtString = prtString .. "|No description}}"
	print(prtString)
end

print("}}")
print("</onlyinclude>")

I inputted 'EasingStyle', and it outputted this, which is perfect bar the lack of description, which is prety impossible for a script to do.

This enum was generated by a script. Data may be incorrect.
The EasingStyle Enum has 8 numbers:
Enum Name Description
0 Linear No description
1 Sine No description
2 Back No description
3 Quad No description
4 Quart No description
5 Quint No description
6 Bounce No description
7 Elastic No description