Difference between revisions of "Structs (Papyrus)"

3 bytes removed ,  09:38, 2 February 2023
m
no edit summary
imported>Valie
 
m
 
Line 52: Line 52:
</source>
</source>


You can, of course, make a property that is an struct. The editor will show a special UI for it that allows you to edit it.
You can, of course, make a property that is a struct. The editor will show a special UI for it that allows you to edit it.


Example:
Example:
Line 107: Line 107:
</source>
</source>


Usually you'll be assigning these directly to new struct variables, but if a function wants an struct, you can make the new struct in the function call, like so:
Usually you'll be assigning these directly to new struct variables, but if a function wants a struct, you can make the new struct in the function call, like so:


Example:
Example:
Line 145: Line 145:


=Casting Structs=
=Casting Structs=
Structs can be cast to strings, bools, or vars. If you cast a struct to a string, it will put each member in the struct inside brackets, separated by commas, prefixed by the member name, in the order they were specified in the script. If the struct is especially large, it may trim the string a little early and put an ellipsis on the end. If you cast an struct to a bool, it will be true if the variable is pointing at any non-none value, and false if it is none.
Structs can be cast to strings, bools, or vars. If you cast a struct to a string, it will put each member in the struct inside brackets, separated by commas, prefixed by the member name, in the order they were specified in the script. If the struct is especially large, it may trim the string a little early and put an ellipsis on the end. If you cast a struct to a bool, it will be true if the variable is pointing at any non-none value, and false if it is none.


Example:
Example:
12

edits