JavaScript-1.5 Reference

JS_CallFunction Function

Summary

Calls a specified function.

Syntax

JSBool JS_CallFunction(JSContext *cx, JSObject *obj,
    JSFunction *fun, uintN argc, jsval *argv, jsval *rval);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
objJSObject *The "current" object on which the function operates; the object specified here is "this" when the function executes.
*funJSFunction *Pointer to the function to call.
argcuintNNumber of arguments you are passing to the function.
argvjsval *Pointer to the array of argument values to pass to the function.
rvaljsval *Pointer to a variable to hold the return value from the function call.

Description

JS_CallFunction calls a specified function, fun, on an object, obj. In terns of function execution, the object is treated as this.

In argc, indicate the number of arguments passed to the function. In argv, pass a pointer to the actual argument values to use. There should be one value for each argument you pass to the function; the number of arguments you pass may be different from the number of arguments defined for the function.by the function.

rval is a pointer to a variable that will hold the function's return value, if any, on successful function execution.

If the called function executes successfully, JS_CallFunction returns JS_TRUE. Otherwise it returns JS_FALSE, and rval is undefined.

Notes

To call a method on an object, use JS_CallFunctionName.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_CallFunctionName | JS_CallFunctionValue | JS_CompileFunction | JS_DecompileFunction | JS_DecompileFunctionBody | JS_DefineFunction | JS_DefineFunctions | JS_GetFunctionObject | JS_NewFunction | JS_SetBranchCallback | JS_ValueToFunction ]

This page was generated by APIDOC