User:Trappingnoobs/EnumAutoformat.lua: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Trappingnoobs
New page: --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.
 
>Trappingnoobs
Added script I made :D
Line 2: Line 2:


--It only works with enums that go from 0 to highest number with no breaks. If there are, you'll need to manually adjust.
--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>")

Revision as of 15:01, 21 July 2011

--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("

This enum was generated by a script. Data may be incorrect.

")

print("") print("

{{{1}}}
Enum Name Description

{{{2}}}

")

print("")