Skip to content

Instantly share code, notes, and snippets.

@vercte
Created June 17, 2023 12:09
Show Gist options
  • Save vercte/55a6f9677447d795b52e0a150b212977 to your computer and use it in GitHub Desktop.
Save vercte/55a6f9677447d795b52e0a150b212977 to your computer and use it in GitHub Desktop.
Dictionary Extension Documentation (Turbowarp)

The icon for the Dictionaries Extension

Use the extension 👉 Editor

Documention

Reporters/Booleans

(list of dictionaries)

Returns a space-separated list of all the active, non-empty dictionaries.

(stringify dictionary (foo) into JSON)

Returns a dictionary that is converted back into JSON; for example, foo = bar turns into { foo: bar }

(get key (bar) from dictionary [foo v])

Gets the key bar from dictionary foo; in bar = baz this will return baz.

<key (bar) in dictionary (foo) is defined?>

Finds if the key bar in dictionary foo is not equal to undefined.

<key (bar) in dictionary (foo) is null?>

Finds if the key bar in dictionary foo is null; this usually only appears if you parse from JSON.

Blocks

parse JSON ({"bar": "baz"}) into dictionary (foo)

Works as JSON.Parse, but converts the dictionary into the special type that this extension uses; allowing you to read the data easily.

set key (bar) in dictionary (foo) to (baz)

Sets key bar in the foo dictionary to baz. Essentially foo: ( bar = baz )

change key (number) in dictionary (foo) by (1)

Adds 1 to a specific key; turns foo: ( number = 1) into foo: ( number = 2 ).

remove dictionary (foo)

Removes a dictionary, deleting all keys and removing it from the list of dictionaries.

remove key (bar) from dictionary (foo)

Removes a key from a dictionary, undefining it and making it not show up in the output JSON.

@no1anator
Copy link

Could you add an example project in extensions.turbowarp.org that is a basic file system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment