Difference between revisions of "FindStruct - Array"
m
Made mention that asVarName parameter cannot be a variable, must be a raw string literal. Added example for clarity.
imported>Plplecuyer |
imported>DavidJCobb m (Made mention that asVarName parameter cannot be a variable, must be a raw string literal. Added example for clarity.) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
'''Member of:''' [[:Category:Arrays| All Arrays]] | |||
'''Member of:''' All | |||
Locates a particular value in a struct inside an array and returns the index | Locates a particular value in a struct inside an array and returns the index | ||
Line 11: | Line 9: | ||
== Parameters == | == Parameters == | ||
*asVarName: The name of the struct variable to compare with | *asVarName: The name of the struct variable to compare with (cannot be a variable, must be a raw string) | ||
*akElement: The element to locate | *akElement: The element to locate | ||
*aiStartIndex: Where to start the search | *aiStartIndex: Where to start the search | ||
Line 31: | Line 29: | ||
int secondPosition = MyPointArray.FindStruct("Y", 10, firstPosition + 1) | int secondPosition = MyPointArray.FindStruct("Y", 10, firstPosition + 1) | ||
Debug.Trace("Found a second point with an Y of 10 at position " + secondPosition) | Debug.Trace("Found a second point with an Y of 10 at position " + secondPosition) | ||
</source> | |||
<br/> | |||
<source lang="papyrus"> | |||
;bad, cannot pass a variable to asVarName, won't compile! | |||
String axis = "Y" | |||
int firstPosition = MyPointArray.FindStruct(axis, 10) | |||
</source> | </source> | ||
Line 37: | Line 41: | ||
*[[Find - Array]] | *[[Find - Array]] | ||
*[[RFind - Array]] | *[[RFind - Array]] | ||
[[Category:Scripting]] | |||
[[Category:Papyrus]] | |||
[[Category:Arrays]] |