JS_LookupProperty |
Function |
|
Summary
Determines if a specified property exists.
|
Syntax
JSBool JS_LookupProperty(JSContext *cx, JSObject *obj,
const char *name, jsval *vp);
Name | Type | Description |
cx | JSContext * | Pointer to a JS context from which to derive runtime information.
|
obj | JSObject * | Object to search on for the property.
|
name | const char * | Name of the property to look up.
|
vp | jsval * | 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
|