From 5574113d632dca6eee309411b73706b4b8db0bde Mon Sep 17 00:00:00 2001 From: quietly-turning Date: Thu, 25 Jun 2020 05:06:16 -0400 Subject: [PATCH] tidy preformatted code examples in LuaDoc --- Docs/Luadoc/LuaDocumentation.xml | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 8de4ee0a4a..3532861279 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -789,6 +789,14 @@ save yourself some time, copy this for undocumented things: + + The StepMania engine makes some of its namespaces available to Lua. These can be thought of as collections of utility functions.
+ Example using SongUtil to get playable from a song given the current : +

+local song = GAMESTATE:GetCurrentSong()
+local playable_steps = SongUtil.GetPlayableSteps(song)
+
+
Returns the for the file at sPath. @@ -864,20 +872,17 @@ save yourself some time, copy this for undocumented things: Enumerated types are lookup tables associating a string to each numerical value for each Enum. For example, - [1] would be the + PlayerNumber[1] would be the string 'PlayerNumber_P1'.
- The functions defined in the Enum namespace are valid member + The functions in this Enum namespace are valid member functions of every Enum where the first argument is - omitted and the name of the Enum is used in place - of Enum. Instead of - Enum.GetName( - ) or - Enum.Reverse( - ), one can use - :GetName() or - :Reverse(), respectively. + omitted and the name of the Enum is used in place + of Enum.
+ For example:
+ Enum.GetName(PlayerNumber) and + Enum.Reverse(PlayerNumber) can be used like
+ PlayerNumber:GetName() and + PlayerNumber:Reverse(), respectively.
Both x and y need to be elements of the enumerated @@ -893,10 +898,12 @@ save yourself some time, copy this for undocumented things: will return the string 'PlayerNumber'. - Returns a reverse lookup table for the enumerated type e. For - example:
local r = - Enum.Reverse( );
- local n = r['PlayerNumber_P2'];

+ Returns a reverse lookup table for the enumerated type e. For + example: +

+local r = PlayerNumber:Reverse()
+local n = r['PlayerNumber_P2']
+
The value of n in this case would be 1 corresponding to the 0-based indexing using in C++ and not 2 as might be expected for the 1-based indexing used in Lua.