AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry:     JS_SetArrayLength (Function)
Summary:     Specifies the number of elements for an array object.
Syntax:
JSBool JS_SetArrayLength(JSContext *cx, JSObject *obj,
jsint length);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     obj     JSObject *     Array object for which to set the number of array elements.
                 
     length     jsint     Number of array elements to set.
                 
Description:
JS_SetArrayLength specifies the number of elements for an array object, objlength indicates the number of elements. If JS_SetArrayLength successfully sets the number of elements, it returns JS_TRUE. Otherwise it returns JS_FALSE.

You can call JS_SetArrayLength either to set the number of elements for an array object you created without specifying an initial number of elements, or to change the number of elements allocated for an array. If you set a shorter array length on an existing array, the elements that no longer fit in the array are destroyed.


See also:
JS_AliasElement
JS_DefineElement
JS_DeleteElement
JS_GetArrayLength
JS_GetElement
JS_IsArrayObject
JS_LookupElement
JS_NewArrayObject
JS_SetElement

[sh-index] Back to list of manuals