Piecewise

Build chat bots with blocks

Persistent data

By default, Piecewise will not save any data when your bot stops, leaving it up to you to manage data you want to keep. There are a few ways to save and load data into Piecewise:

  1. Using the save list to file and load list from file blocks
  2. Using the save table to file and load table from file blocks
  3. Using the [append to|write] file with text and contents of file as text blocks.

Where Piecewise looks for and/or saves data from these blocks depends on your operating system and how you run your bot:

  1. Windows: %appdata%\Piecewise\.lazurite
  2. macOS: ~/Library/Application Support/Piecewise/.lazurite
  3. Linux: ~/.lazurite

Saving and loading lists

To save and load data stored as a list, use the save list to file and load list from file blocks. When loading, if the requested file does not exist or does not contain a JSON-encoded table, an empty table will be returned.

Saving and loading lists

Open in Piecewise

Saving and loading tables

To save and load data stored as a table, use the save table to file and load table from file blocks. When loading, if the requested file does not exist or does not contain a JSON-encoded table, an empty table will be returned.

Saving and loading tables

Open in Piecewise

Saving and loading arbitrary text

To save and load arbitrary text, use the [append to|write] file with text and contents of file as text blocks.

When loading, if the file does not exist, an error will be thrown. Use the if file exists block to check if a file exists before loading it.

Appending to a file will add the supplied text to the end of it. Overwriting the file will clear its contents and replace it with the supplied text.

Saving and loading tables

Open in Piecewise