LibRPC F: Difference between revisions
(Created page with "<poem style="border: 2px solid #d6d2c5; background-color: #f2f4e6; padding: 1em;"> This function was added in LibRPC (API 1.2) and will not work on previous versions. </poem> {{Welcome|desc=This will return a userdata which can be passed to RFC for calling remote functions.| 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...") |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 17: | Line 17: | ||
Note that npc must be elevated to admin, for all remote calls to execute. <source lang="lua" inline>player.IsAdmin=true</source> | Note that npc must be elevated to admin, for all remote calls to execute. <source lang="lua" inline>player.IsAdmin=true</source> | ||
| | | | ||
relfuncs=*[[RFC]] | relfuncs=*[[LibRPC_RFC|RFC]] | ||
|}} | |}} | ||
Parameter types supported of the returned closure are: | Parameter types supported of the returned closure are: | ||
{{RFCParamTypes}} | {{RFCParamTypes}} | ||
Latest revision as of 10:02, 3 May 2023
This function was added in LibRPC (API 1.2) and will not work on previous versions.
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
npc script
local a = F("format")("The total no:of players is %d\n", F("GetPlayers")() )
local b = RFC( "print" )( a );which will output like: The total no:of players is 1 on server console.
Note that npc must be elevated to admin, for all remote calls to execute. player.IsAdmin=true
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 |