Dot Operator
From NWN Lexicon
Jump to navigationJump to searchDot (".") Operator
The dot operator can be used to gain access to public data within a struct or some data types like vectors.
// working with a struct
struct strName
{
string First;
string Last;
};
void main()
{
struct strName test;
// dot operator assignment
test.First = "Bob";
test.Last = "Dobbs";
// dot operator access<br />
string sFname = test.First;
string sLname = test.Last;
// working with a vector data type
vector v = Vector(1.0f, 2.0f, 3.0f);
v.x = 12.0f;
}
struct strName
{
string First;
string Last;
};
void main()
{
struct strName test;
// dot operator assignment
test.First = "Bob";
test.Last = "Dobbs";
// dot operator access<br />
string sFname = test.First;
string sLname = test.Last;
// working with a vector data type
vector v = Vector(1.0f, 2.0f, 3.0f);
v.x = 12.0f;
}
author: Ryan Hunt, editor: Charles Feduke