Function: ObjectHasName
Function: ObjectHasName

Function: ObjectHasName

ObjectHasName ( OBJECT, NAME )

Checks if an object has an assigned name.


Parameter Type Description
OBJECT OBJECT The object to inspect.
NAME VALUE(STRING) The name to test for.


VALUE(BOOLEAN) TRUE on a name match, FALSE on no match.

What It Does

This function inspects an object and returns TRUE if the provided name is one the names that the provided object is assigned, or FALSE if not.

Object names, when added to (but not removed from) objects, are sanitized, such that multi-word names only contain one space to separate words. For example, red     paint turns into red paint. Functions that check for matching names do not sanitize the name that is looked for.

Names are matched case-insensitively.


Object Names Example

object o_ball named "ball" uses determiners "the";

	function nameTest(list)
		local i;
		for (i = 0; i < length(list); i = i + 1)
			textln("Object has name \""+list[i]+"\": " + ObjectHasName(o_ball, list[i]));

		local names = [
			"the ball", 
			"red ball", 
			"the red ball"

		textln("Adding \"red ball\"...");
		addObjectName(o_ball, "red ball");
		textln("Removing \"ball\"...");
		removeObjectName(o_ball, "ball");

See Also

AddObjectName() — Adds an interpretable name to an object.
RemoveObjectName() — Removes an interpretable name from an object.


Modal Header