From NWN Lexicon
Revision as of 10:12, 16 October 2017 by (talk)
Jump to: navigation, search

A structure of different variable types combined into a single variable. Can be used with functions to decrease their complexity by returning many values at once. Values in the struct are set or retrieved using the dot (".") operator.


// Struct definition
struct Name
    string First;
    string Last;
void main()
    // Struct declaration
    struct Name MyName;
    // Dot operator assignment
    MyName.First = "Bob";
    MyName.Last  = "Dobbs";
    // Dot operator access
    SpeakString("My name is " + MyName.First + " " + MyName.Last); // Say "My name is Bob Dobbs"

See Also

Struct Primer