This file documents the LoLa Runtime Library, a set of basic I/O routines to enable standalone LoLa programs.
The API in this document is meant for the standalone LoLa interpreter and functions listed here are not necessarily available in embedded programs!
Exit(code: number): noreturn
This function will stop execution of the program and will return
code to the OS.
ReadFile(path: string): string|void
Reads in the contents of a file located at
path as a
string or returns
void when the file does not exist or the given path is not a file.
WriteFile(path: string, contents: string): void
contents to the file located at
path. If the file does not exist, it will be created.
FileExists(path: string): boolean
true if a file exists at the given
Will print every argument to the standard output. All arguments of type
string will be printed verbatim, non-
string arguments are converted into a human-readable form and will then be printed.
After all arguments are printed, a line break will be outputted.
Reads a line of text from the standard input and returns it as a
string. If the standard input is in the end of file state,
void will be returned.
CreateList([init: array]): object
Returns a new object that implements a dynamic list.
init is given, the list will be initialized with the contents of
This list has the following API:
Appends a new item to the back of the list.
Removes all occurrances of
item in the list.
Removes the item at
index. Indices start at
0. When the index is out of range, nothing will happen.
Returns the current number of elements in the list.
Returns the item at
index or panics with
list.SetItem(index, value): void
Replaces the item at
Returns the current list as an array.
Returns first the index of
item in the list or
void if the item was not found.
Resizes the list to
size items. New items will be set to
Removes all items from the list.
Returns a new object that implements a key-value store.
Returns the value associated with
key or returns
key does not have a associated value.
dict.Set(key, value): void
Sets the associated value for
void, the key will be removed.
Removes any value associated with
true when a key was removed else
true if the dictionary contains a value associated with
Returns an array with all keys stored in the dictionary.
Returns an array with all values stored in the dictionary.
Removes all values from the dictionary.
Returns the number of keys currently stored in the list.