project
The projects this machine has opened, the templates a new one starts from, and the folder picker the OS provides. What the editor's start screen is made…
On this page
The projects this machine has opened, the templates a new one starts from, and the folder picker the OS provides. What the editor's start screen is made of.
14 functions, 0 constants. Scripts reach it as project::.
Functions
Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.
| function | acts on | what it does |
|---|---|---|
copy_example(string, string) -> project::Project |
— | Copy one example into into under its own name, so the shipped one stays as it is. Answers { path, name }, or { error }. |
create(string, string) -> project::Project |
— | Write a new project at path from a template id, or from nothing when the id is empty. Answers { path, name }, or { error }. |
editor_data_directory() -> string |
— | The editor's per-user folder, <data>/balaur-editor beside the games' <data>/balaur/<name>: editor.toml, projects.toml, sessions/ and themes/. Made on first ask. |
examples() -> [project::Example] |
— | The example projects shipped beside the editor: { id, name, note, cover, path } each, where cover is a picture the editor's own project holds, or empty. |
forget(string) |
— | Drop one project from the list. The folder is not touched. |
home() -> string |
— | Where a new project goes unless the reader says otherwise: the home directory on a desktop, and the app's own writable directory where there is no such thing. |
in_tab() -> bool |
— | Whether this editor runs in a browser tab, where the page holds the projects and opening one is its call rather than this screen's. |
open(string) -> project::Opened |
— | Remember path and start the editor on it, then ask this one to quit. Answers { error } when there is no project there. |
open_beside(string) -> project::Opened |
— | Start a second editor on path and keep this one: Edit dependency on a path dependency, whose project is another folder. Answers { error } when there is no project there or no second editor can start. |
pick_directory() -> str? |
— | Open the OS folder picker and answer what was chosen, or () when it was dismissed. Blocks while the dialog is up, and answers () on a platform with no picker. |
recent() -> [project::Recent] |
— | The projects opened on this machine, newest first: { path, name, opened, exists } each, where opened is a Unix time in seconds and exists says whether the folder is still there. |
templates() -> [project::Template] |
— | What a new project may start from: { id, note } each, read from the editor's own library. |
use_data(str?) -> str? |
— | Keep save:: slots and the device id in the user data directory of the game named name, and let fs reach it, so a game played here and run alone share saves and a device login. Nil goes back to the editor's own. Answers the directory, or nil. |
version() -> string |
— | The version of the binary the editor is running in. |