contents   index   previous   next



SElib.getObjectProperties()

syntax:

SElib.getObjectProperties(object[,

                          includeUndefined])

where:

object - an object from which to get its properties.

 

includeUndefined - a boolean, determines whether or not to include properties with undefined values. The default is false, that is, do not include properties with undefined values.

 

return:

object - an array of strings which are the names of the properties of the object. The array is terminated with a null, that is, the last element is always null.

 

description:

Get the names of the properties of an object in an array of strings in which each element is a property name and the last element is null.

 

The parameter includeUndefined must be true to return properties that are not defined. If includeUndefined is false, then only properties that have defined data are included. The default for includeUndefined is false.

 

The final member of the returned array returned is always null. If the parameter object is not defined or contains no properties, then the return is an array with a single element set to null.

 

SElib.getObjectProperties() is similar to the ECMAScript for/in loop. The important difference is that a for/in loop does not enumerate properties that have DONT_ENUM as part of their attributes (global.setAttributes()), whereas SElib.getObjectProperties() includes them in the array that it returns.

 

see:

for/in, Object propertyIsEnumerable()

 

example:

var Point;

Point.row = 5;

Point.col = 8;

Point.height;

DisplayAllStructureMembers(Point);

 

function DisplayAllStructureMembers(ObjectVar)

{

   Screen.writeln("Object Properties:");

   var MemberList = SElib.getObjectProperties(ObjectVar);

   for (var i = 0; MemberList[i]; i++)

   Clib.printf("  %s\n", MemberList[i]);

}

 

// This fragment produces the following output.

// Object Properties:

//   row

//   col

 


SElib.inSecurity()