User:Trappingnoobs/EnumAutoformat.lua
From Legacy Roblox Wiki
Jump to navigationJump to search
--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>")