REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 6-Feb-2009 Edit History  

REBOL 3 Concepts: Scripts: Saving Scripts

Pending Revision

This document was written for R2 and has yet to be revised for R3.

Data can be saved to a script file in a format that can be loaded into REBOL with the load function. This is a useful way to save data values and blocks of data. In this fashion, it is possible to create entire mini-databases.

The save function expects two arguments: a file name and either a block or a value to be saved:

data: [Buy 100 shares at $20.00 per share]

save %data.r data

The data is written out in REBOL source text format, which can be loaded later with:

data: load %data.r

Simple values can also be saved and loaded. For instance, a date stamp can be saved with:

save %date.r now

and later reloaded with:

stamp: load %date.r

In the previous example, because stamp is a single value, it is not enclosed in a block when loaded.

To save a script file with a header, the header can be provided in a refinement as either an object or a block:

header: [Title: "This is an example"]

save/header %data.r data header

!save/all !save/flat !save/only


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin