This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
codex [2022/06/17 22:15] – justin | codex [2022/12/22 18:17] (current) – justin | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- | ---- | ||
- | A **codex** is a data type with its data stored as key/value pairs. Each key is a unique [[string]] and acts as a lookup for its corresponding value within the codex, similar to a dictionary. The key/value pairs are enclosed by square brackets after the " | + | A **codex** is a data type with its data stored as key/value pairs. Each key is a unique [[string]] and acts as a lookup for its corresponding value within the codex, similar to a dictionary. The key/value pairs are enclosed by square brackets after the " |
====Example: | ====Example: | ||
Line 8: | Line 8: | ||
codex[" | codex[" | ||
</ | </ | ||
- | The codex variable will contain a lookup with keys named " | + | The codex variable |
+ | ====Modifying a Value:==== | ||
+ | <code bauxite> | ||
+ | $my_codex = codex[" | ||
+ | $my_codex[" | ||
+ | </ | ||
+ | The script above creates a codex variable containing lookups for an item ID and a numeric count value, then modifies the count to 10. | ||
+ | |||
+ | ====Inserting a Value:==== | ||
+ | <code bauxite> | ||
+ | $my_codex = codex[]; | ||
+ | $my_codex[" | ||
+ | </ | ||
+ | The script above creates an empty codex variable, then inserts a new key/value pair with a key of " | ||
+ | |||
+ | ~~NOTOC~~ |