ColdC: Function/Method Reference: data()


ANY data([OBJNUM ancestor])

This function is used to retrieve the values for object variables on the current object. If ancestor is not defined it will return all data defined by any ancestor. If ancestor is defined it will only return data which is defined by the specific ancestor.

A dictionary is generated for each ancestor which defines data (or for the specific requested ancestor). Each variable defined by the ancestor is a key in the dictionary, with he association to the key being the value of the object variable. For instance, if object $root defined the variable name with a value of "Fred", the association in the dictionary would be ['name, "Fred"]. Reference the section on Dictionaries for more details on the construction of dictionaries.

If only one ancestor is requested with data() then only the dictionary for that ancestor is returned. If no ancestor is specified then another dictionary is created, with each ancestor being a key and the association being the dictionary containing the object variables for that ancestor.

If an ancestor defines an object variable, but has never assigned a value to it on the current object (or the object variable has been cleared using the function clear_var()), it is not included in the dictionary.

The keys in a dictionary returned by data() do not have any particular ordering.


Last Modified on Feb 28 1996
Copyright © 1995, 1996, Brandon Gillespie