User:Trappingnoobs/EnumAutoformat.lua: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Trappingnoobs No edit summary |
>Trappingnoobs Removed some accidental pastes of previous texts I didn't notice in preview. |
||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
print("{{EmphasisBox|This enum was generated by a script. Data may be incorrect.}}") | print("{{EmphasisBox|This enum was generated by a script. Data may be incorrect.}}") | ||
print("<onlyinclude>") | print("<onlyinclude>") | ||
print("{{Enum|The "..eN.." [[Enum]] has ".. #En:GetEnumItems() .. " numbers:") | print("{{Enum|The "..eN.." [[Enum]] has ".. #En:GetEnumItems() .. " numbers:|") | ||
Line 31: | Line 31: | ||
print("</onlyinclude>") | print("</onlyinclude>") | ||
</pre> | </pre> | ||
I inputted 'EasingStyle', and it outputted this, which is perfect bar the lack of description, which is prety impossible for a script to do. | |||
{{EmphasisBox|This enum was generated by a script. Data may be incorrect.}} | |||
{{Enum|The EasingStyle [[Enum]] has 8 numbers:| | |||
{{Enum/row|0|Linear|No description}} | |||
{{Enum/row|1|Sine|No description}} | |||
{{Enum/row|2|Back|No description}} | |||
{{Enum/row|3|Quad|No description}} | |||
{{Enum/row|4|Quart|No description}} | |||
{{Enum/row|5|Quint|No description}} | |||
{{Enum/row|6|Bounce|No description}} | |||
{{Enum/row|7|Elastic|No description}} | |||
}} |
Latest revision as of 15:06, 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("{{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 |