LibRPC Z: Difference between revisions
No edit summary |
No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<poem style="border: 2px solid #d6d2c5; background-color: #f2f4e6; padding: 1em;"> | <poem style="border: 2px solid #d6d2c5; background-color: #f2f4e6; padding: 1em;"> | ||
This function was added in LibRPC (API 1. | This function was added in LibRPC (API 1.4) (released on 27.Jun.2023) and will not work on previous versions. | ||
</poem> | </poem> | ||
{{Welcome|desc= | {{Welcome|desc=Perform sq_get on remote HSQUIRRELVM. 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 | ::p1 : If string, a sq_get will be performed by pushing roottable and if p2 is present second sq_get will be performed on this resultant object. If p1 is not string, then p1 is pushed and sq_get will be done on p1, they key being p2. | ||
'''Optional Parameters''' | '''Optional Parameters''' | ||
::p2, p3, ... : A key which will be | ::p2, p3, ... : A key which will be pushed and sq_get operation performed on p(i-1) | ||
</poem>| | </poem>| | ||
example= | example= | ||
Line 24: | Line 24: | ||
{{!}} | {{!}} | ||
{{!}}- | {{!}}- | ||
{{!}} print( b ) | {{!}} '''print( b )''' <br />where b is some global variable | ||
{{!}} RFC("print")(Z("b")) | {{!}} RFC("print")(Z("b")) | ||
{{!}} | {{!}} | ||
{{!}}- | |||
{{!}} '''print(b.x)''' <br />b is Vector | |||
{{!}} RFC("print")(Z("b", "x") ) | |||
{{!}} | |||
{{!}}} | {{!}}} | ||
| | | | ||
retvals=Returns userdata which can be passed to F/Fa/RFC/RFCa or Z itself.| | |||
relfuncs=*[[LibRPC_F|F]]}} | relfuncs=*[[LibRPC_F|F]] | ||
*[[LibRPC_RFC|RFC]] | |||
*[[LibRPC_S|S]] | |||
}} |
Latest revision as of 07:01, 28 June 2023
This function was added in LibRPC (API 1.4) (released on 27.Jun.2023) and will not work on previous versions.
Description:
Perform sq_get on remote HSQUIRRELVM. Unlike other functions, this is a first order function.
Parameters:
( p1, p2, ... )
p1 : If string, a sq_get will be performed by pushing roottable and if p2 is present second sq_get will be performed on this resultant object. If p1 is not string, then p1 is pushed and sq_get will be done on p1, they key being p2.
Optional Parameters
p2, p3, ... : A key which will be pushed and sq_get operation performed on p(i-1)
Return Values:
Returns userdata which can be passed to F/Fa/RFC/RFCa or Z itself.
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")) | |
print(b.x) b is Vector |
RFC("print")(Z("b", "x") ) |
Related Functions
The following functions may be helpful as they relate to this function in one way or another.