F: Difference between revisions
No edit summary |
No edit summary |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<poem style="border: 2px solid #d6d2c5; background-color: #f2f4e6; padding: 1em;"> | |||
This function was added in v1.6 beta and will not work on previous versions. | |||
</poem> | |||
<poem style="border: 2px solid #d6d2c5; background-color: #f9f3e6; padding: 1em;"> | |||
This function belongs to server scripts and not npcscripts. | |||
</poem> | |||
<poem style="border: 2px solid #d6d2c5; background-color: #ffff00; padding: 1em;"> | |||
The parameter type userdata was added in v1.6 beta 2 and will not work in v1.6 beta. | |||
</poem> | |||
{{Welcome|desc=This will return a userdata which can be passed to [[RFC]] for calling remote functions.| | {{Welcome|desc=This will return a userdata which can be passed to [[RFC]] for calling remote functions.| | ||
params=<syntaxhighlight>funcname</syntaxhighlight>| | params=<syntaxhighlight>[string]funcname or [userdata]</syntaxhighlight> | ||
<poem> | |||
::funcname : The name of a function of the npcscript or userdata returned by F(On the assumption that call to just mentioned F returns a function which is our target function). | |||
This F can be nested indefinitely either in first set of brackets or in the second set of brackets. See [[Examples]] for the former type of nesting.</poem>| | |||
retvals=The function returns a userdata.| | retvals=The function returns a userdata.| | ||
example= | example= | ||
Line 8: | Line 20: | ||
local b = RFC( npcid, "print" )( a ); | local b = RFC( npcid, "print" )( a ); | ||
</source> | </source> | ||
relfuncs=*[[RFC]] | which will output <source lang="lua" inline>My name is npcname</source> on npc console. | ||
| | |||
relfuncs=*[[RFC]] | |||
|}} | |||
Parameter types supported of the returned closure are: | |||
{{RFCParamTypes}} |
Latest revision as of 18:21, 13 February 2023
This function was added in v1.6 beta and will not work on previous versions.
This function belongs to server scripts and not npcscripts.
The parameter type userdata was added in v1.6 beta 2 and will not work in v1.6 beta.
Description:
This will return a userdata which can be passed to RFC for calling remote functions.
Parameters:
[string]funcname or [userdata]
funcname : The name of a function of the npcscript or userdata returned by F(On the assumption that call to just mentioned F returns a function which is our target function).
This F can be nested indefinitely either in first set of brackets or in the second set of brackets. See Examples for the former type of nesting.
Return Values:
The function returns a userdata.
Example
Server Script
local a = F("format")("My name is %s\n", F("GetMyName")() ) local b = RFC( npcid, "print" )( a );
which will output My name is npcname
on npc console.
Related Functions
The following functions may be helpful as they relate to this function in one way or another.
Parameter types supported of the returned closure are:
Numbers/Integers | |
Float | |
String | |
bool | true/false |
Null | null |
Vector | Vector(x,y,z) |
Quaternion | Quaternion(x,y,z,w) |
Userdata returned by F (Function) | F("print")(500) See F |
Array |
The following parameter types are not supported:
Blob |
Class Instances other than Vector or Quaternion |