What is it?
This extension provides primitives for writing and reading string values to and from a keyed, persistent data store.
Why use it?
The primary purpose of this extension on NetLogo desktop is to provide compatibility with the NetLogo Web version. This extension provides a unified way for a model to read and write data that persists across model loads in NetLogo desktop or NetLogo Web.
In NetLogo Web, due to the browser-based runtime environment, persistent storage available between model compiles or page refreshes must be provided in an asynchronous way using web APIs. While NetLogo desktop can simply write and read to files to store data using the built-in file primitives, NetLogo Web has no way to interact with files on a user's computer without user interaction.
Why to not use it?
If you need a way to store and retrieve key/value pairs inside a program, like a dictionary or map data structure, see the Table extension (desktop) or the nlmap extension (web). If you need a way to write data to files for use outside of NetLogo, see the built-in
file-* primitives (desktop) or the SendTo extension (web and desktop). If you want to read data into a model from an external source, see the Fetch extension (web and desktop).
|list-stores||callback||Gets a list of all the different stores that have been created, and passes them as an argument to the given
|switch-store||store-name||Changes the currently used store to the one with the given name. If it doesn't exist, it will be created. You can switch to the default starting store by using the empty string argument,
|delete-store||store-name||Deletes the store with the given name. You cannot delete the currently used store, or the default store named
|put||key value callback||Stores the given string
|get||key callback||Gets the string
|has-key||key callback||Checks if the given
|get-keys||callback||Gets a list of all keys in the store, and passes that list as an argument to the given `callback anonymous command.|
|remove||key callback||Removes the given
|clear||callback||Removes all keys and their values from the store. If the optional
The extension uses an H2 embedded database to store the key/value pairs. The default storage location is in the user-specific application data folder, determined by operating system:
- On Windows, this is
- On macOS, this is
- On Linux, this is
Open it in SBT. If you successfully run
store.jar is created.
The NetLogo Store extension is in the public domain. To the extent possible under law, Uri Wilensky has waived all copyright and related or neighboring rights.