User Tools

Site Tools


codex

This is an old revision of the document!


Codex


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 “codex” keyword, with each key as a string and a colon between a key and its corresponding value. Key/value pairs are separated by commas. If loading data from a JSON file and it contains an object with properties, the object will be stored as a codex (see Data Files). See below for an example.

Example:

codex["id": "ITEM_0001", "count": 5]

The codex variable will contain a lookup with keys named “id” and “count”, with corresponding values of “ITEM_0001” (as a string value) and 5 (as a number value). You could create a JSON data file containing an array of these codices as an easy way to maintain a list of items to give to the player when the game starts.

codex.1655529266.txt.gz · Last modified: 2022/06/17 22:14 by justin