OpenPreferences

Family: Preference · 3 forms

What it does

OpenPreferences opens s on a Preference object. It takes filename (a string), and answers an integer. That is the first of 3 forms.

Syntax

1
OpenPreferences(filename string) → integer
2
OpenPreferences(filename string, flags integer) → integer
3
OpenPreferences(filename string, flags integer, encoding integer) → integer

Parameters

NameTypeIn forms
filenamestringall
flagsinteger2, 3
encodinginteger3

Every form returns

integer

Example · generated

Form 1, the short one

DO  Print(OpenPreferences("assets/data.dat"))  Sync()LOOP

Form 3, with every argument

DO  Print(OpenPreferences("assets/data.dat", 1, 1))  Sync()LOOP

OpenPreferences is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

27 commands in Preference