378
Chapter 4: C-Level Extensibility
unsigned short *JS_ValueToString()
Usage
unsigned short *JS_ValueToString(JSContext *cx, jsval v,
unsigned int *pLength)
Description
Method; extracts a function argument from a
jsval
structure, converts it to a string, if possible,
and passes the converted value back to the caller.
Note:
Do not modify the returned buffer pointer or you might corrupt the data structures of the
JavaScript interpreter. To change the string, you must copy the characters into another buffer and
create a new JavaScript string.
Arguments
JSContext
*cx
,
jsval
v
,
unsigned int
*pLength
•
The
cx
argument is the opaque
JSContext
pointer that passes to the JavaScript function.
•
The
v
argument is the
jsval
structure
from which the string is to be extracted.
•
The
pLength
argument is a pointer to an unsigned integer. This function sets
*plength
equal
to the length of the string in bytes.
Returns
A pointer that points to a null-terminated string if successful or to a
null
value on failure. The
calling routine must not free this string when it finishes.
JSBool JS_ValueToInteger()
Usage
JSBool JS_ValueToInteger(JSContext *cx, jsval v, long *lp);
Description
Method; extracts a function argument from a
jsval
structure, converts it to an integer (if
possible), and passes the converted value back to the caller.
Arguments
JSContext
*cx
,
jsval
v
,
long
*lp
•
The
cx
argument is the opaque
JSContext
pointer that passes to the JavaScript function.
•
The
v
argument is the
jsval
structure
from which the integer is to be extracted.
•
The
lp
argument is a pointer to a 4-byte integer. This function stores the converted value
in
*lp
.
Returns
A Boolean value:
JS_TRUE
indicates success;
JS_FALSE
indicates failure.
Содержание FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY
Страница 1: ...Flash JavaScript Dictionary ...
Страница 16: ...16 Contents ...
Страница 40: ...40 Chapter 2 Top level functions ...
Страница 368: ...368 Chapter 3 Objects ...
Страница 386: ...386 Chapter 4 C Level Extensibility ...