JavaScript-1.5 Reference

JS_LookupProperty Function

Summary

Determines if a specified property exists.

Syntax

JSBool JS_LookupProperty(JSContext *cx, JSObject *obj,
    const char *name, jsval *vp);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
objJSObject *Object to search on for the property.
nameconst char *Name of the property to look up.
vpjsval *Pointer to a variable into which to store the last retrieved value of the property if it exists. If not, vp is set to JSVAL_VOID.

Description

JS_LookupProperty examines a specified JS object, obj, for a property named name. If the property exists, vp is set either to the last retrieved value of the property if it exists, or to JSVAL_VOID if it does not, and JS_LookupProperty returns JS_TRUE. On error, such as running out of memory during the search, JS_LookupProperty returns JS_FALSE, and vp is undefined.

Notes

JS_LookupProperty does not distunguish between a property with a value of undefined and a property that does not exist.  Use JS_GetPropertyAttributes to distinguish these cases.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JSVAL_VOID | JS_AliasProperty | JS_DefineProperty | JS_DefinePropertyWithTinyId | JS_DefineUCProperty | JS_DefineUCPropertyWithTinyID | JS_DeleteProperty | JS_GetProperty | JS_GetPropertyAttributes | JS_PropertyStub | JS_SetProperty ]

This page was generated by APIDOC