~~NOTOC~~
<=[[4rpl:start| Index]] \\
<=[[4rpl:start#tables| Tables]]
* [[4rpl:commands:GetTableElement|Get]]
* [[4rpl:commands:SetTableElement|Set]]
====== GetTableElement ======
GetTableElement(<-table <-key) ->value
===== Description =====
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.
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 =====
CreateTable ->table
SetTableElement(<-table "SomeKey" 42)
trace(GetTableElement(<-table "SomeKey")) #prints "42"
#alternate syntax
#Use curly braces around to surround the key.
trace(<-table{"SomeKey"}) #prints "42"
<=[[4rpl:start| Index]]