JS GetElement
From MDC
Find a specified numeric property of an object and return its current value.
[edit] Syntax
JSBool JS_GetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
The context in which to perform the property lookup.
Requires request. (In a |
obj |
JSObject * |
The object to search for the element. |
index |
jsint |
Index of the element to look up. |
vp |
jsval * |
Out parameter. On success, *vp receives the current value of the element, if it exists, and JSVAL_VOID otherwise. |
[edit] Description
JS_GetElement examines a specified JS object, obj, and its prototype chain, for an element or numeric property numbered index.
If the element exists, JS_GetElement sets *vp to the element's current value. If not, it sets *vp to JSVAL_VOID and returns JS_TRUE (to indicate no error occurred). If the search fails with an error or exception, JS_GetElement returns JS_FALSE, and the value left in *vp is undefined.
[edit] See Also
LXR ID Search for JS_GetElement
JS_DefineElement, JS_DeleteElement, JS_GetArrayLength, JS_IsArrayObject, JS_LookupElement, JS_NewArrayObject, JS_SetArrayLength, JS_SetElement