|
findex
| Format:
findex (object-field) |
Purpose:
Returns the index of object-field within the object or
null if object-field is no object field.
Example 1:
heitml input:
<let gl.characters=emptytuple;
gl.characters.Eliza="Eliza Doolittle";
gl.characters.Higgins="Prof. Henry Higgins";
? findex(gl.characters.Eliza) "Nn"; ? " ";
? findex(gl.characters.Higgins) "Nn"; ? " ";
? findex(gl.characters.ET) "Nn";
>
| resulting output:
0 1 null
|
Tip:
The findex() function can be useful
if you want to implement efficient lookup methods with an object field in
another object.
Example 2:
heitml input:
<let actors=array(len(gl.characters));
actors[findex(gl.characters.Eliza)]="Audrey Hepburn";
actors[findex(gl.characters.Higgins)]="Rex Harris";
? "The actor of Eliza Doolittle in My Fair Lady is: "
+actors[findex(gl.characters.Eliza)];
>
| resulting output:
The actor of Eliza Doolittle in My Fair Lady is: Audrey Hepburn
|
Note that the lookup in
actors[fname(gl.characters.Eliza)]
would have resulted in a search in object actors whereas
actors[findex(gl.characters.Eliza)]
results in a direct access within object actors.
See Also:
fname().
This page was dynamically generated by
heitml
© 1996-2009 H.E.I. All Rights Reserved
|