Updates from quietly for lua docs
This commit is contained in:
+1
-1
@@ -204,7 +204,7 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<link rel="icon" type="image/vnd.microsoft.icon" href="./favicon.ico"/>
|
||||
<link rel="icon" type="image/x-icon" href="./favicon.ico"/>
|
||||
</head>
|
||||
<body>
|
||||
<xsl:apply-templates />
|
||||
|
||||
@@ -76,7 +76,7 @@ save yourself some time, copy this for undocumented things:
|
||||
</Function>
|
||||
<Function name='BinaryToHex' return='string' arguments='string s'>
|
||||
Converts a binary formatted string to hexadecimal format.
|
||||
This can be useful in conjunction with <Link class="CryptManager" />'s MD5 and SHA functions.
|
||||
This can be useful in conjunction with <Link class='CryptManager' />'s MD5 and SHA functions.
|
||||
</Function>
|
||||
<Function name='BoostColor' theme='_fallback' return='color' arguments='color c, float fBoost'>
|
||||
[02 Colors.lua] Returns the color that results from multiplying <code>c</code>'s R, G, and B values by <code>fBoost</code>.
|
||||
@@ -85,7 +85,8 @@ save yourself some time, copy this for undocumented things:
|
||||
[02 Colors.lua] Modifies the brightness of the specified color.
|
||||
</Function>
|
||||
<Function name='Center1Player' theme='_fallback' return='bool' arguments=''>
|
||||
[02 Utilities.lua] Returns <code>true</code> if Center 1P is being used.
|
||||
[02 Utilities.lua] Returns <code>true</code> if the <code>Center1Player</code> preference is enabled during single style. Returns <code>true</code> when the style is double or routine, regardless of the <code>Center1Player</code> preference.<br />
|
||||
Returns <code>false</code> otherwise.
|
||||
</Function>
|
||||
<Function name='CheckpointsTapsSeparateJudgment' theme='_fallback' return='bool' arguments=''>
|
||||
[03 Gameplay.lua] Returns <code>true</code> if checkpoint judgments and tap judgments
|
||||
@@ -162,7 +163,7 @@ save yourself some time, copy this for undocumented things:
|
||||
Creates a RageBezier2D for you to use. Make sure you destroy the RageBezier2D when you're done with it, or you will have a memory leak.
|
||||
</Function>
|
||||
<Function name='create_spline' return='CubicSplineN' arguments=''>
|
||||
Creates a CubicSplineN for you to use. Make sure you <Link class="CubicSplineN" function='destroy'>destroy</Link> the CubicSplineN when you're done with it, or you will have a memory leak.
|
||||
Creates a CubicSplineN for you to use. Make sure you <Link class='CubicSplineN' function='destroy'>destroy</Link> the CubicSplineN when you're done with it, or you will have a memory leak.
|
||||
</Function>
|
||||
<Function name='CustomDifficultyToColor' theme='_fallback' return='color' arguments='string cd'>
|
||||
[02 Colors.lua]
|
||||
@@ -187,7 +188,7 @@ save yourself some time, copy this for undocumented things:
|
||||
</Function>
|
||||
<Function name='dofile' theme='_fallback' return='chunk' arguments='string sFilePath'>
|
||||
<code>dofile</code> is normally a core function of Lua's basic library. StepMania overrides this in
|
||||
[01 base.lua] to use <Link function="loadfile">loadfile</Link>, which itself has been overridden.
|
||||
[01 base.lua] to use <Link function='loadfile'>loadfile</Link>, which itself has been overridden.
|
||||
</Function>
|
||||
<Function name='EvalUsesCheckpointsWithJudgments' theme='_fallback' return='bool' arguments=''>
|
||||
[03 Gameplay.lua]
|
||||
@@ -271,10 +272,10 @@ save yourself some time, copy this for undocumented things:
|
||||
<Function name='GetRandomSongBackground' theme='_fallback' return='string' arguments=''>
|
||||
[02 Utilities.lua] Returns a path to a random song background.
|
||||
</Function>
|
||||
<Function name='GetReal' theme="_fallback" return='float' arguments=''>
|
||||
<Function name='GetReal' theme='_fallback' return='float' arguments=''>
|
||||
[02 Actor.lua]
|
||||
</Function>
|
||||
<Function name='GetRealInverse' theme="_fallback" return='float' arguments=''>
|
||||
<Function name='GetRealInverse' theme='_fallback' return='float' arguments=''>
|
||||
[02 Actor.lua]
|
||||
</Function>
|
||||
<Function name='GetScreenAspectRatio' return='float' arguments=''>
|
||||
@@ -371,20 +372,20 @@ save yourself some time, copy this for undocumented things:
|
||||
will iterate over the pairs (1,t[1]), (2,t[2]), ···, up to the first integer key absent from the table.<br />
|
||||
<code>ipairs</code> is a core function of Lua's basic library; see the Lua manual for more details.
|
||||
</Function>
|
||||
<Function name='IsArcade' theme="_fallback" return='bool' arguments=''>
|
||||
<Function name='IsArcade' theme='_fallback' return='bool' arguments=''>
|
||||
[02 Utilities.lua] Returns <code>true</code> if the coin mode is not set to <Link class='ENUM' function='CoinMode'>CoinMode_Home</Link>.
|
||||
</Function>
|
||||
<Function name='IsCourse' theme="_fallback" return='bool' arguments=''>
|
||||
<Function name='IsCourse' theme='_fallback' return='bool' arguments=''>
|
||||
Returns <code>true</code> if the current <Link class='ENUM' function='PlayMode' /> is Nonstop, Oni, or Endless.<br />
|
||||
This is effectively the same as <Link class='GameState' function='IsCourseMode' />.
|
||||
</Function>
|
||||
<Function name='IsFreePlay' theme="_fallback" return='bool' arguments=''>
|
||||
<Function name='IsFreePlay' theme='_fallback' return='bool' arguments=''>
|
||||
[02 Utilities.lua] Returns <code>true</code> if <Link function='IsArcade'>IsArcade()</Link> and the coin mode is <Link class='ENUM' function='CoinMode'>CoinMode_Free</Link>.
|
||||
</Function>
|
||||
<Function name='IsGame' theme='_fallback' return='bool' arguments='string sGame'>
|
||||
[03 Gameplay.lua] Returns <code>true</code> if the current game is <code>sGame</code>.
|
||||
</Function>
|
||||
<Function name='IsHome' theme="_fallback" return='bool' arguments=''>
|
||||
<Function name='IsHome' theme='_fallback' return='bool' arguments=''>
|
||||
[02 Utilities.lua] Returns <code>true</code> if the coin mode is set to <Link class='ENUM' function='CoinMode'>CoinMode_Home</Link>.
|
||||
</Function>
|
||||
<Function name='IsNetConnected' return='bool' arguments=''>
|
||||
@@ -444,7 +445,7 @@ save yourself some time, copy this for undocumented things:
|
||||
</Function>
|
||||
<Function name='loadfile' theme='_fallback' return='chunk' arguments='string sFilePath'>
|
||||
<code>loadfile</code> is normally a core function of Lua's basic library. StepMania overrides this in
|
||||
[01 base.lua] to use <Link class="lua" function="ReadFile">lua.ReadFile</Link>.
|
||||
[01 base.lua] to use <Link class='lua' function='ReadFile'>lua.ReadFile</Link>.
|
||||
</Function>
|
||||
<Function name='LoadFallbackB' theme='_fallback' return='ActorDef' arguments=''>
|
||||
[02 ActorDef.lua] Load the fallback BGA for the element that is currently being loaded.
|
||||
@@ -752,7 +753,7 @@ Trace(b) -- "BlendMode_AlphaMask"
|
||||
This way, a theme can implement a custom interactive screen for adjusting those preferences.
|
||||
</Function>
|
||||
<Function name='Var' theme='_fallback' return='ThreadVariable' arguments=''>
|
||||
[01 base.lua] Alias for <Link class="lua" function="GetThreadVariable">lua.GetThreadVariable</Link>.
|
||||
[01 base.lua] Alias for <Link class='lua' function='GetThreadVariable'>lua.GetThreadVariable</Link>.
|
||||
</Function>
|
||||
<Function name='VersionDate' return='string' arguments=''>
|
||||
Returns the current version's build date, formatted as YYYYMMDD.
|
||||
@@ -891,10 +892,15 @@ local playable_steps = SongUtil.GetPlayableSteps(song)
|
||||
omitted and the name of the Enum is used in place
|
||||
of <code>Enum</code>.<br />
|
||||
For example:<br />
|
||||
<code>Enum.GetName(PlayerNumber)</code> and
|
||||
<code>Enum.Reverse(PlayerNumber)</code> can be used like<br />
|
||||
<code>PlayerNumber:GetName()</code> and
|
||||
<code>PlayerNumber:Reverse()</code>, respectively.
|
||||
<pre><code>
|
||||
Enum.GetName(PlayerNumber)
|
||||
Enum.Reverse(PlayerNumber)
|
||||
</code></pre>
|
||||
can be condensed like<br />
|
||||
<pre><code>
|
||||
PlayerNumber:GetName()
|
||||
PlayerNumber:Reverse()
|
||||
</code></pre>
|
||||
</Description>
|
||||
<Function name='Compare' return='int' arguments='Enum e, string x, string y'>
|
||||
Both <code>x</code> and <code>y</code> need to be elements of the enumerated
|
||||
@@ -913,12 +919,13 @@ local playable_steps = SongUtil.GetPlayableSteps(song)
|
||||
Returns a reverse lookup table for the enumerated type <code>e</code>. For
|
||||
example:
|
||||
<pre><code>
|
||||
local r = PlayerNumber:Reverse()
|
||||
local n = r['PlayerNumber_P2']
|
||||
local pn1 = PlayerNumber:Reverse()['PlayerNumber_P1']
|
||||
local pn2 = PlayerNumber:Reverse()['PlayerNumber_P2']
|
||||
-- pn1 is 0
|
||||
-- pn2 is 1
|
||||
</code></pre>
|
||||
The value of <code>n</code> in this case would be <code>1</code> corresponding
|
||||
to the 0-based indexing using in C++ and not <code>2</code> as might be
|
||||
expected for the 1-based indexing used in Lua.
|
||||
Note that the values returned from <code>Reverse()</code> will correspond
|
||||
to the 0-based indexing from C++ and not 1-based indexing conventional to Lua.
|
||||
</Function>
|
||||
</Namespace>
|
||||
<Namespace name='lua'>
|
||||
@@ -961,7 +968,11 @@ local n = r['PlayerNumber_P2']
|
||||
</Namespace>
|
||||
<Namespace name='RageFileUtil'>
|
||||
<Function name='CreateRageFile' return='RageFile' arguments=''>
|
||||
Creates a RageFile handle with which one can use the commands in <Link class='RageFile' />.
|
||||
Creates a RageFile handle with which one can use the commands in <Link class='RageFile' />.<br />
|
||||
Example:
|
||||
<pre><code>
|
||||
local file = RageFileUtil.CreateRageFile()
|
||||
</code></pre>
|
||||
</Function>
|
||||
</Namespace>
|
||||
<Namespace name='ScreenSystemLayerHelpers'>
|
||||
@@ -1119,7 +1130,7 @@ local n = r['PlayerNumber_P2']
|
||||
Sets the Actor's base Z zoom to <code>zoom</code>.
|
||||
</Function>
|
||||
<Function name='blend' return='void' arguments='BlendMode mode'>
|
||||
Sets the Actor to use the specified blend mode.
|
||||
Sets the Actor to use the specified <Link class='ENUM' function='BlendMode' />.
|
||||
</Function>
|
||||
<Function name='bob' return='void' arguments=''>
|
||||
Makes the Actor bob up and down. Can use <Link function='effectmagnitude' /> to define different bobbing behavior.
|
||||
@@ -1262,7 +1273,7 @@ local n = r['PlayerNumber_P2']
|
||||
<br />
|
||||
The different effects use percent_through_effect in different ways. Some use it to calculate percent_between_colors with this sine wave: sin((percent_through_effect + 0.25f) * 2 * PI ) / 2 + 0.5f<br />
|
||||
Some effects check the internal bool blink_on. blink_on is true if percent_through_effect is greater than 0.5 and false if percent_through_effect is less than or equal to 0.5.<br /><br />
|
||||
Check the effect functions for individual explanations: <Link function="diffuseblink" />, <Link function="diffuseshift" />, <Link function="glowblink" />, <Link function="glowshift" />, <Link function="glowramp" />, <Link function="rainbow" />, <Link function="wag" />, <Link function="bounce" />, <Link function="bob" />, <Link function="pulse" />, <Link function="spin" />, <Link function="vibrate" />.
|
||||
Check the effect functions for individual explanations: <Link function='diffuseblink' />, <Link function='diffuseshift' />, <Link function='glowblink' />, <Link function='glowshift' />, <Link function='glowramp' />, <Link function='rainbow' />, <Link function='wag' />, <Link function='bounce' />, <Link function='bob' />, <Link function='pulse' />, <Link function='spin' />, <Link function='vibrate' />.
|
||||
</Function>
|
||||
<Function name='effect_hold_at_full' return='void' arguments='float hold_at_full'>
|
||||
Set the hold_at_full part of the effect timing while leaving the others unchanged.
|
||||
@@ -1456,11 +1467,34 @@ end
|
||||
<Function name='rotationz' return='void' arguments='float fRotation'>
|
||||
Set the Actor's rotation on the Z axis to <code>fRotation</code> degrees.
|
||||
</Function>
|
||||
<!-- RunCommandsRecursively -->
|
||||
<Function name='scale_or_crop_alternative' theme="_fallback" return='void' arguments=''>
|
||||
<Function name='RunCommandsRecursively' return='void' arguments='LuaReference cmds'>
|
||||
Recursively runs the commands in <code>cmds</code> on the Actor's children, as well as the Actor itself.<br />
|
||||
Since <code>RunCommandsRecursively</code> belongs to StepMania's base <code>Actor</code> class, it is available to all specialized actors. Calling it from an ActorFrame or ActorFrameTexture can be helpful, as those specialized actors can contain children actors.<br />
|
||||
See <Link class='ActorFrame' function='RunCommandsOnChildren' /> and <Link class='ActorFrame' function='runcommandsonleaves' /> for related needs.<br />
|
||||
Example:
|
||||
<pre><code>
|
||||
Def.ActorFrame{
|
||||
Name="AF",
|
||||
|
||||
Def.Sprite{ Name="sun", Texture="sun.png" },
|
||||
|
||||
Def.ActorFrame{
|
||||
Name="AF2",
|
||||
InitCommand=function(self)
|
||||
-- bounce() will be applied to AF2, airhorn, and catchphrase
|
||||
self:RunCommandsRecursively( function(actor) actor:bounce() end )
|
||||
end,
|
||||
|
||||
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
|
||||
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</Function>
|
||||
<Function name='scale_or_crop_alternative' theme='_fallback' return='void' arguments=''>
|
||||
[02 Actor.lua] An alternative version of <Link function='scale_or_crop_background' />.
|
||||
</Function>
|
||||
<Function name='scale_or_crop_background' theme="_fallback" return='void' arguments=''>
|
||||
<Function name='scale_or_crop_background' theme='_fallback' return='void' arguments=''>
|
||||
[02 Actor.lua]
|
||||
</Function>
|
||||
<Function name='scaletocover' return='void' arguments='float fLeft, float fTop, float fRight, float fBottom'>
|
||||
@@ -1541,7 +1575,7 @@ end
|
||||
</Function>
|
||||
<Function name='valign' return='void' arguments='float fAlign'>
|
||||
Set the fractional vertical alignment of the Actor according to <code>fAlign</code> which should be a float in the range 0..1. An alignment of 0 is top-aligned while an alignment of 1 is bottom-aligned.<br />
|
||||
Use <Link function="vertalign" /> for the common case.
|
||||
Use <Link function='vertalign' /> for the common case.
|
||||
</Function>
|
||||
<Function name='vertalign' return='void' arguments='VertAlign align'>
|
||||
Set the <Link class='ENUM' function='VertAlign' /> of the Actor according to <code>align</code>.<br />
|
||||
@@ -1551,7 +1585,7 @@ spr.InitCommand=function(self)
|
||||
self:vertalign('VertAlign_Bottom')
|
||||
end
|
||||
</code></pre>
|
||||
Use <Link function="valign" /> for fractional alignment.
|
||||
Use <Link function='valign' /> for fractional alignment.
|
||||
</Function>
|
||||
<Function name='vibrate' return='void' arguments=''>
|
||||
Makes the Actor vibrate violently. Can use <Link function='effectmagnitude' /> to define different vibration behavior.
|
||||
@@ -1645,8 +1679,8 @@ end
|
||||
A common convention is to add children at the next index (current size of the table plus <code>1</code>).<br />
|
||||
Basic example:
|
||||
<pre><code>
|
||||
-- in the context of a lua file as a screen layer
|
||||
-- this ActorFrame is a table
|
||||
-- in the context of a .lua file as a screen layer
|
||||
-- this ActorFrame can be thought of as a Lua table
|
||||
local af = Def.ActorFrame{}
|
||||
|
||||
-- add a Sprite at the next index
|
||||
@@ -1665,7 +1699,7 @@ af[#af+1] = Def.BitmapText{
|
||||
return af
|
||||
</code></pre>
|
||||
When actor commands like <Link class='Actor' function='xy' /> and <Link class='Actor' function='zoom' />
|
||||
are used position and scale an ActorFrame, its children will position relative to the parent ActorFrame
|
||||
are used to position and scale an ActorFrame, its children will position relative to the parent ActorFrame
|
||||
and scale proportionally.<br />
|
||||
For example, if you want to animate 50 actors moving 100px to the right in unison, it is easier to move the
|
||||
parent ActorFrame than each actor individually.<br />
|
||||
@@ -1694,6 +1728,8 @@ af[#af+1] = Def.Sprite{
|
||||
|
||||
return af
|
||||
</code></pre>
|
||||
Likewise, if you stop drawing an ActorFrame by applying <code>visible(false)</code> to it, its children
|
||||
will stop drawing with it.<br />
|
||||
ActorFrames can contain ActorFrames, and doing so is good design for sufficiently complex screens.
|
||||
</Description>
|
||||
|
||||
@@ -1742,10 +1778,48 @@ return af
|
||||
Removes the specified child from the ActorFrame.
|
||||
</Function>
|
||||
<Function name='RunCommandsOnChildren' return='void' arguments='LuaReference cmds'>
|
||||
Runs the commands in <code>cmds</code> on the ActorFrame's children.
|
||||
Runs the commands in <code>cmds</code> on the ActorFrame's immediate children. <br />
|
||||
See <Link class='Actor' function='RunCommandsRecursively' /> and <Link function='runcommandsonleaves' /> for related needs.<br />
|
||||
Example:
|
||||
<pre><code>
|
||||
Def.ActorFrame{
|
||||
Name="AF",
|
||||
InitCommand=function(self)
|
||||
-- bounce() will be applied to sun and AF2
|
||||
self:RunCommandsOnChildren( function(child) child:bounce() end )
|
||||
end,
|
||||
|
||||
Def.Sprite{ Name="sun", Texture="sun.png" },
|
||||
|
||||
Def.ActorFrame{
|
||||
Name="AF2",
|
||||
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
|
||||
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</Function>
|
||||
<Function name='runcommandsonleaves' return='void' arguments='LuaReference cmds'>
|
||||
Runs the commands in <code>cmds</code> on the ActorFrame's leaves.
|
||||
Runs the commands in <code>cmds</code> on the ActorFrame's leaves. Leaves are nodes in the ActorFrame tree that have no further child nodes.<br />
|
||||
See <Link function='RunCommandsOnChildren' /> and <Link class='Actor' function='RunCommandsRecursively' /> for related needs.<br />
|
||||
Example:
|
||||
<pre><code>
|
||||
Def.ActorFrame{
|
||||
Name="AF",
|
||||
InitCommand=function(self)
|
||||
-- bounce() will be applied to sun, airhorn, and catchphrase
|
||||
self:runcommandsonleaves( function(leaf) leaf:bounce() end )
|
||||
end,
|
||||
|
||||
Def.Sprite{ Name="sun", Texture="sun.png" },
|
||||
|
||||
Def.ActorFrame{
|
||||
Name="AF2",
|
||||
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
|
||||
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</Function>
|
||||
<Function name='SetAmbientLightColor' return='void' arguments='Color c'>
|
||||
Sets the ActorFrame's ambient light color to <code>c</code>.
|
||||
@@ -4763,11 +4837,11 @@ prev_note_name, succeeded = options:NoteSkin("cel")
|
||||
Returns the profile for player <code>pn</code>.
|
||||
</Function>
|
||||
<Function name='GetProfileDir' return='string' arguments='ProfileSlot slot'>
|
||||
Returns the profile directory for the provided <Link class="ENUM" function="ProfileSlot">ProfileSlot</Link>, formatted like <code>/Save/LocalProfiles/00000001/</code>.<br />
|
||||
Returns an empty string if the provided <Link class="ENUM" function="ProfileSlot">ProfileSlot</Link> does not have a <Link class="Profile" /> loaded.
|
||||
Returns the profile directory for the provided <Link class='ENUM' function='ProfileSlot'>ProfileSlot</Link>, formatted like <code>/Save/LocalProfiles/00000001/</code>.<br />
|
||||
Returns an empty string if the provided <Link class='ENUM' function='ProfileSlot'>ProfileSlot</Link> does not have a <Link class='Profile' /> loaded.
|
||||
</Function>
|
||||
<Function name='GetSongNumTimesPlayed' return='int' arguments='Song s, ProfileSlot ps'>
|
||||
Returns the number of times Song <code>s</code> has been played with the specified <Link class="ENUM" function="ProfileSlot">ProfileSlot</Link>.
|
||||
Returns the number of times Song <code>s</code> has been played with the specified <Link class='ENUM' function='ProfileSlot'>ProfileSlot</Link>.
|
||||
</Function>
|
||||
<Function name='GetStatsPrefix' return='string' arguments=''>
|
||||
Returns the current stats prefix.
|
||||
@@ -5203,7 +5277,10 @@ Details of the <code>event</code> table:
|
||||
This should behave identically to the normal back button behavior. This function is for the pause menu to use when the player forfeits or restarts, so that a score isn't saved.
|
||||
</Function>
|
||||
<Function name='Center1Player' return='bool' arguments=''>
|
||||
Returns <code>true</code> if a single <Link class='Player' /> has its NoteField centered.
|
||||
Returns <code>true</code> if a single <Link class='Player' /> has its NoteField centered using the <code>Center1Player</code> preference.<br />
|
||||
Will return <code>false</code> if the current theme has <code>AllowCenter1Player=false</code> under <code>[ScreenGameplay]</code>.<br />
|
||||
Notably, this can return <code>false</code> when the player's NoteField is visually centered, as is convention in <Link class='ENUM' function='StyleType'>double style</Link> or <Link class='ENUM' function='StepsType'>Techno_Single8</Link>.<br />
|
||||
Refer to the global function <Link class='GLOBAL' function='Center1Player' /> for a somewhat more robust check.
|
||||
</Function>
|
||||
<Function name='GetDummyPlayerInfo' return='PlayerInfo' arguments='int index'>
|
||||
Returns a dummy PlayerInfo for the specified index.
|
||||
@@ -5320,7 +5397,7 @@ Details of the <code>event</code> table:
|
||||
</Function>
|
||||
<Function name='GetAnyStillEntering' return='bool' arguments=''>
|
||||
Returns <code>true</code> if anyone is still entering their name.<br />
|
||||
(As opposed to those who are Finalized; see <Link function="GetFinalized" />)
|
||||
(As opposed to those who are Finalized; see <Link function='GetFinalized' />)
|
||||
</Function>
|
||||
<Function name='GetEnteringName' return='bool' arguments='PlayerNumber pn'>
|
||||
Returns <code>true</code> if Player <code>pn</code> is entering their name.
|
||||
@@ -6043,7 +6120,7 @@ local spr = Def.Sprite{
|
||||
Returns <code>true</code> if any player has given up on the song.
|
||||
</Function>
|
||||
<Function name='GetEarnedExtraStage' return='EarnedExtraStage' arguments=''>
|
||||
Returns the <Link class="ENUM" function="EarnedExtraStage">EarnedExtraStage</Link> value.
|
||||
Returns the <Link class='ENUM' function='EarnedExtraStage'>EarnedExtraStage</Link> value.
|
||||
</Function>
|
||||
<Function name='GetGameplaySeconds' return='float' arguments=''>
|
||||
Returns the number of seconds played.
|
||||
@@ -6057,7 +6134,7 @@ local spr = Def.Sprite{
|
||||
</Function>
|
||||
<Function name='GetPossibleSongs' return='{Song}' arguments='' />
|
||||
<Function name='GetStage' return='Stage' arguments=''>
|
||||
Returns the <Link class="ENUM" function="Stage">Stage</Link> value.
|
||||
Returns the <Link class='ENUM' function='Stage'>Stage</Link> value.
|
||||
</Function>
|
||||
<Function name='GetStageIndex' return='int' arguments=''>
|
||||
Returns the stage index.
|
||||
@@ -6742,7 +6819,7 @@ local bpms_and_times = timing_data:GetBPMsAndTimes(true)
|
||||
<Description>
|
||||
StepMania's enums are exposed to Lua as global tables. Note that although the enum values start at 0, these global Lua tables are indexed starting at 1.<br />
|
||||
Functions that require enums as arguments will accept either the string constant or number value.<br />
|
||||
For example, <Link class='GameState' function='SetPreferredDifficulty' /> accepts a <code>PlayerNumber</code> and <code>Difficulty</code> as arguments.
|
||||
For example, <Link class='GameState' function='SetPreferredDifficulty' /> accepts a <Link class='ENUM' function='PlayerNumber' /> and <Link class='ENUM' function='Difficulty' /> as arguments.
|
||||
Each of these is valid way to set P1's preferred difficulty to hard:<br />
|
||||
<pre><code>
|
||||
-- using strings
|
||||
@@ -6751,6 +6828,24 @@ GAMESTATE:SetPreferredDifficulty( "PlayerNumber_P1", "Difficulty_Hard" )
|
||||
GAMESTATE:SetPreferredDifficulty( 0, 3 )
|
||||
-- using global Lua tables
|
||||
GAMESTATE:SetPreferredDifficulty( PlayerNumber[1], Difficulty[4] )
|
||||
</code></pre>
|
||||
It's worth pointing out that, as tables, these enums can be iterated over using <Link class='GLOBAL' function='ipairs' /> or <Link class='GLOBAL' function='ivalues' />. This can be handy when you want to perform some action on every value in an enum; for example, displaying a graphic for each Difficulty.
|
||||
<pre><code>
|
||||
-- Difficulty is a global Lua table that corresponds with
|
||||
-- the StepMania engine's Difficulty enum
|
||||
for i, diff in ipairs(Difficulty) do
|
||||
|
||||
-- append a file extension to create a string like
|
||||
-- "Difficulty_Beginner.png"
|
||||
local filename = diff .. ".png"
|
||||
|
||||
-- load files like "Difficulty_Beginner.png",
|
||||
-- "Difficulty_Easy.png", etc. from the directory
|
||||
-- where this code is run, and offset each vertically
|
||||
af[#af+1] = LoadActor( filename )..{
|
||||
InitCommand=function(self) self:y( i * 100 ) end
|
||||
}
|
||||
end
|
||||
</code></pre>
|
||||
</Description>
|
||||
<Enum name='BlendMode'>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Reference in New Issue
Block a user