User Tools

Site Tools


4rpl:commands:gettableelement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
4rpl:commands:gettableelement [2021/01/08 16:01] – external edit 127.0.0.14rpl:commands:gettableelement [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
-<=[[4rpl:start| Index]]+<=[[4rpl:start| Index]] \\ 
 +<=[[4rpl:start#tables| Tables]] 
 + 
 +<WRAP tabs> 
 +  * [[4rpl:commands:GetTableElement|Get]] 
 +  * [[4rpl:commands:SetTableElement|Set]] 
 +</WRAP>
  
 ====== GetTableElement ====== ====== GetTableElement ======
Line 8: Line 14:
 Retrieves an element from a table and pushes it to the stack. Note that keys are case sensitive strings. Retrieves an element from a table and pushes it to the stack. Note that keys are case sensitive strings.
 A special syntax can also be used to retrieve a table element. See the example below. A special syntax can also be used to retrieve a table element. See the example below.
 +
 +If the specified element (key) does not exists in the table, the return value will have a type of NULL and can be tested with the [[GetType]] command.
  
  ===== Examples =====  ===== Examples =====
Line 13: Line 21:
  CreateTable ->table  CreateTable ->table
  SetTableElement(<-table "SomeKey" 42)  SetTableElement(<-table "SomeKey" 42)
- trace(GetTableElement(<-table "SomeKey))  #prints "42"+ trace(GetTableElement(<-table "SomeKey"))  #prints "42"
  
  #alternate syntax  #alternate syntax
4rpl/commands/gettableelement.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)