call: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (fix deleted spawn refs)
mNo edit summary
Line 11: Line 11:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Executes the '''function string'''.
| Executes the function string.


Argument(s) (if any) are passed as _this. (Argument'''s''' are passed in an array) |= Description
The ''argument(s)'' (if any) are passed as _this. (''argument(s)'' are passed in an array) |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| Argument(s) '''call''' "function string" |= Syntax
| argument(s) '''call''' body |= Syntax


|p1= Argument(s): [[Any Value]] - Optional. Argument that is passed to the function in the "_this" variable. |= Parameter 1
|p1= argument(s): [[Any Value]] - Optional. Argument that is passed to the function in the "_this" variable. |= Parameter 1


|p2= function string: [[String]] - A function body provided directly 'inline' or
|p2= body: [[Code]] - A function body provided directly 'inline' or
the [[String]] returned from the commands [[loadFile]] or [[preprocessFile]].
the [[String]] returned from the commands [[loadFile]] or [[preprocessFile]].




| [[Any Value]] -   
| [[Anything]] -   
The last value given in the function is returned. See the topic [[Function]] for more information. |= Return value
The last value given in the function is returned. See the topic [[Function]] for more information. |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________

Revision as of 16:11, 5 February 2009

Hover & click on the images for description

Description

Description:
Executes the function string. The argument(s) (if any) are passed as _this. (argument(s) are passed in an array)
Groups:
Uncategorised

Syntax

Syntax:
argument(s) call body
Parameters:
argument(s): Any Value - Optional. Argument that is passed to the function in the "_this" variable.
body: Code - A function body provided directly 'inline' or the String returned from the commands loadFile or preprocessFile.
Return Value:
Anything - The last value given in the function is returned. See the topic Function for more information.

Examples

Example 1:
Operation Flashpoint syntax: _fAdd = loadFile "add.sqf" [1,2] call _fAdd Armed Assault syntax: _fAdd = compile loadFile "add.sqf" _result = [1,2] call _fAdd

Additional Information

See also:
call codespawncompilepreprocessFile

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

This command syntax only works in OFP. In Arma, the call command can only be passed code data type, not string data type. To change a string data type to a code data type, use the compile command. Example:
_function = loadfile "myfunc.sqf";
call compile _function;

See the call_code article for more details. --General Barron 09:12, 16 January 2009 (CET)

Bottom Section