Cold Help System: Programming: ColdC Reference Manual: Objects: Referencing Objects

Objects exist within the database, and are referenced with a unique number or Object Number (objnum), which is assigned to the object upon its creation in the database. Object numbers cannot be changed after an object is created. When an object is destroyed, it's objnum is not re-used by the driver unless the database is decompiled to text and recompiled.

An object can also have an Object Name assigned to it, which can be changed througout the life of the object. Object Name's are only unique to that object, while the object has the name. Once the name is changed the old name can be taken by another object. Object Names exist for practical functionality, as it is easier to remember references which consist of alphabetic and numeric characters, compared to references which are simply numeric.

In ColdC an object number is designated with a hash mark ('#') followed by the object's number. For instance #23 refers to object number 23. An object name is designated as an identifier beginning with a dollar sign ($). For instance, if the object #23 has the name object_23 assigned to it, it would be formatted in ColdC as: $object_23.

A negative object number will appear if there is no object in the database with the given object number--i.e. if it is an invalid object number. This is true for all cases, except #-1, which is the generic Invalid Object Number.

Both the object number and object name are generically called database references (dbrefs). When the driver formats a database reference the Object Name will take precedence over an Object Number, because the name is generally easier to remember and comprehend.

When the interpreter encounters an object name, it looks up the number associated with that name in a table. If no object has been assigned to that name, a ~namenf error is thrown; otherwise the object name is equivalent to the object number when executing.

Referencing Objects | Methods | Variables | Special Object Status

the Cold Dark