CreateBoolArray - Utility: Difference between revisions

From the CreationKit Wiki
Jump to navigation Jump to search
(Created page with "Category:Scripting Category:Papyrus '''Member of:''' Utility Script Creates an array of Bool values, with the specified length. '''Be careful when using this func...")
 
m (Convert source tags to syntaxhighlight)
 
Line 6: Line 6:


== Syntax ==
== Syntax ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
Bool[] Function CreateBoolArray(Int size, Bool fill = False) Native
Bool[] Function CreateBoolArray(Int size, Bool fill = False) Native
</source>
</syntaxhighlight>


== Parameters ==
== Parameters ==
Line 18: Line 18:


== Examples ==
== Examples ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
Bool[] myArray = Utility.CreateBoolArray(129) ; Create an array longer than the Papyrus compiler would allow
Bool[] myArray = Utility.CreateBoolArray(129) ; Create an array longer than the Papyrus compiler would allow
</source>
</syntaxhighlight>


== Notes ==
== Notes ==

Latest revision as of 20:55, 5 September 2026

Member of: Utility Script

Creates an array of Bool values, with the specified length. Be careful when using this function. It is possible to create arrays longer than 128 elements, and size is treated as an unsigned integer. Negative numbers will produce extremely large values, which can cause major issues.

Syntax[edit | edit source]

Bool[] Function CreateBoolArray(Int size, Bool fill = False) Native

Parameters[edit | edit source]

  • size: The length of the array.
  • fill: Unused due to a bug in SKSE. The intention was for each array in the element to be set to this value.

Return Value[edit | edit source]

A Bool array of length size. The elements in the array will most likely be True, but there is no guarantee that they will have any particular value.

Examples[edit | edit source]

Bool[] myArray = Utility.CreateBoolArray(129) ; Create an array longer than the Papyrus compiler would allow

Notes[edit | edit source]

  • As mentioned above, an SKSE bug means that the contents of the array — the values of the bools — are effectively random. This bug should not affect the functions that create arrays of other types. Refer to the Talk page for more details.

See Also[edit | edit source]