19
edits
imported>Evildavo (Added an advanced example of how to simulate an array larger than 128) |
(→Large Arrays: Added SKSE Array helper description.) |
||
Line 105: | Line 105: | ||
<br> | <br> | ||
== Advanced Usage == | == Advanced Usage == | ||
=== Large Arrays === | === SKSE === | ||
If an array larger than 128 elements is required a work-around is to use multiple arrays to form one large array. Below is an example of how this can be accomplished for an array that can hold 512 floats: | You can create Arrays larger than 128 elements and variable in size using the helper functions in the [[Utility_Script#SKSE_Global_Functions|Utility script]]. | ||
<source lang="papyrus"> | |||
float[] LongArrayOfFloats = Utility.CreateFloatArray(512) | |||
int i = 2048 | |||
string[] VariableSizeArrayOfStrings = Utility.CreateStringArray(i) | |||
</source> | |||
You can access it like any other array. | |||
<source lang="papyrus"> | |||
Debug.trace(LongArrayOfFloats[250]) | |||
</source> | |||
SKSE also allows you to resize any array on the fly: | |||
<source lang="papyrus"> | |||
Utility.ResizeStringArray(VariableSizeArrayOfStrings, 64) | |||
</source> | |||
==== Large Arrays without SKSE ==== | |||
If an array larger than 128 elements is required, a work-around is to use multiple arrays to form one large array. Below is an example of how this can be accomplished for an array that can hold 512 floats: | |||
<source lang="papyrus"> | <source lang="papyrus"> |
edits