StructKeyExists

Determines whether a specific key is present in a structure.

Returns: boolean

Usage

StructKeyExists( structure, key )

Arguments

Argument Description
structure
(struct, required)

Name of structure to test

key
(string, required)

Key to test

Examples

Member Function

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow",
	bird: "chirp"
};

// Check to see if key exists in struct
if (
	animals.keyExists("snail")
) {
	echo("There is a snail in 'animals'");
} else {
	echo("No snail exists in 'animals'");
}

Non-Member Function

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow",
	bird: "chirp"
};

// Check to see if key exists in struct
if (
	StructKeyExists(animals, "snail")
) {
	echo("There is a snail in 'animals'");
} else {
	echo("No snail exists in 'animals'");
}

See also