LibRPC Z: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
(Created page with "{{Welcome|desc=Creates userdata when passed to RFC/F/Fa/RFCa has the effect of rawget. Unlike other functions, this is a first order function.| params=<source lang="lua">( p1, p2, ... )</source> <poem> ::p1 : If string, a rawget will be performed on the roottable when executed on remote side. Optional Parameters ::p2, p3, ... : A key which will be popped and get operation performed on p(i-1) </poem>| example= {{{!}} class="wikitable" {{!}}- ! Goal ! Corresponding code !...")
 
No edit summary
Line 1: Line 1:
<poem style="border: 2px solid #d6d2c5; background-color: #f2f4e6; padding: 1em;">
This function was added in LibRPC (API 1.3) (not released as on writing this page) and will not work on previous versions.
</poem>
{{Welcome|desc=Creates userdata when passed to RFC/F/Fa/RFCa has the effect of rawget. Unlike other functions, this is a first order function.|
{{Welcome|desc=Creates userdata when passed to RFC/F/Fa/RFCa has the effect of rawget. Unlike other functions, this is a first order function.|
params=<source lang="lua">( p1, p2, ... )</source>
params=<source lang="lua">( p1, p2, ... )</source>
<poem>
<poem>
::p1 : If string, a rawget will be performed on the roottable when executed on remote side.
::p1 : If string, a rawget will be performed on the roottable and if p2 is present rawget will be performed on this object. If p1 is not string, then p2 is required.
Optional Parameters
Optional Parameters
::p2, p3, ... : A key which will be popped and get operation performed on p(i-1)
::p2, p3, ... : A key which will be popped and get operation performed on p(i-1)
Line 21: Line 24:
{{!}}  
{{!}}  
{{!}}-
{{!}}-
{{!}} print( b ); <br />where b is some global variable
{{!}} RFC("print")(Z("b"))
{{!}}  
{{!}}  
{{!}}  
{{!}}}
{{!}}
|
{{!}}}|
retval=Returns userdata which can be passed to F/Fa/RFC/RFCa or Z itself.|
}}
relfuncs=*[[LibRPC_F|F]]}}

Revision as of 05:00, 27 June 2023

This function was added in LibRPC (API 1.3) (not released as on writing this page) and will not work on previous versions.


Description:
Creates userdata when passed to RFC/F/Fa/RFCa has the effect of rawget. Unlike other functions, this is a first order function.


Parameters:

( p1, p2, ... )

p1 : If string, a rawget will be performed on the roottable and if p2 is present rawget will be performed on this object. If p1 is not string, then p2 is required.
Optional Parameters
p2, p3, ... : A key which will be popped and get operation performed on p(i-1)


Return Values:
This function does not return any specific values.


Example

Goal Corresponding code
FindPlayer( 0 ).Name Z( F("FindPlayer")(0), "Name" )
FindPlayer( 0 ).Pos.x Z( F("FindPlayer")(0), "Pos", "x" )
print( b );
where b is some global variable
RFC("print")(Z("b"))

Related Functions

The following functions may be helpful as they relate to this function in one way or another.