CallLocalFunction
From SA-MP Wiki
(Difference between revisions)
Revision as of 18:11, 11 April 2013 Meta (Talk | contribs) (moved the important note to the top) ← Previous diff |
Current revision Connor Mead (Talk | contribs) |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Title}} | ||
{{Description|Calls a public function from the script in which it is used.}} | {{Description|Calls a public function from the script in which it is used.}} | ||
Line 30: | Line 29: | ||
[[Category:Scripting Functions]] | [[Category:Scripting Functions]] | ||
+ | |||
[[de:CallLocalFunction]] | [[de:CallLocalFunction]] | ||
+ | [[fr:CallLocalFunction]] | ||
[[ru:CallLocalFunction]] | [[ru:CallLocalFunction]] |
Current revision
Description:
Calls a public function from the script in which it is used.
(const function[], const format[], {Float,_}:...)
function[] | Public function's name. |
format[] | Tag/format of each variable |
{Float,_}:... | 'Indefinite' number of arguments of any tag |
Return Values:
The value that the only public function returned.
[edit]
Format Strings
Placeholder | Meaning |
---|---|
a | Passes an array (the next placeholder should be d or i for the array size, so the function will be aware of it).
NOTE: It accepts only one dimension, so a trick like sizeof (array) + sizeof (array) * sizeof (array[]) for the array size would be needed to pass a 2D array. |
c | Passes a single character. |
d, i | Passes an integer (whole) number |
x | Passes a number in hexadecimal notation. |
f | Passes a floating point number. |
s | Passes a string. |
The values for the placeholders follow in the exact same order as parameters in the call.
forward callMe(const string[]); public callMe(const string[]) { printf("callMe> %s", string); return 1; } CallLocalFunction("callMe", "s", "OHAI THAR BAGPUSS!!11");
[edit]
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- CallRemoteFunction: Call a function in any loaded script.