This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
codex [2022/12/22 18:15] – justin | codex [2025/03/11 17:18] (current) – justin | ||
---|---|---|---|
Line 9: | Line 9: | ||
</ | </ | ||
The codex variable above will contain a lookup with keys named " | The codex variable above will contain a lookup with keys named " | ||
+ | |||
+ | ====Reading a Value:==== | ||
+ | <code bauxite> | ||
+ | $my_codex = codex[" | ||
+ | display_message(" | ||
+ | </ | ||
+ | The script above creates a codex variable containing lookups for an item ID and a numeric count value, then displays the count (converted to a [[string]] value) in a message. | ||
====Modifying a Value:==== | ====Modifying a Value:==== | ||
Line 18: | Line 25: | ||
====Inserting a Value:==== | ====Inserting a Value:==== | ||
+ | <code bauxite> | ||
$my_codex = codex[]; | $my_codex = codex[]; | ||
$my_codex[" | $my_codex[" | ||
+ | </ | ||
+ | The script above creates an empty codex variable, then inserts a new key/value pair with a key of " | ||
+ | |||
+ | ====Iterating All Keys:==== | ||
+ | <code bauxite> | ||
+ | $my_codex = codex[" | ||
+ | for $key in $my_codex do | ||
+ | | ||
+ | end; | ||
+ | </ | ||
+ | The script above displays each key of the codex along with its corresponding value. The " | ||
~~NOTOC~~ | ~~NOTOC~~ |