StructGet

Retrieves the value from a struct using a path based expression

Method Signature

StructGet(path=[string])

Arguments

Argument
Type
Required
Description
Default

path

string

true

The string path to the object requested in the struct

Examples

Get a value in a structure using structGet

Run Example

x = { 
	Y : {
		Z : 8
	}
};
writeDump( structGet( "x.y.z" ) );

Result: 8

Accidentally Modifying a Structure

The structGet function will modify the variable x by adding a new structure x.a and also adds a key x.a.b to satisfy the path.

Run Example

Accidentally Overwriting a variable using structGet

The value of x.y.z[2] will be set to an empty struct.

Run Example

Additional Examples

Run Example

Last updated

Was this helpful?