Skip to content

Search

Documentation

import

Imports a .glb or .gltf model, an .aseprite sprite, or a .tmx or .ldtk level into the project being edited, with the importers balaur import runs.

On this page

Imports a .glb or .gltf model, an .aseprite sprite, or a .tmx or .ldtk level into the project being edited, with the importers balaur import runs.

6 functions, 0 constants. Scripts reach it as import::.

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
cancel() — Stop the imports in flight at the end of the file each is writing. What they had written stays where it landed; each reports cancelled with the count it reached.
choose() -> bool — Ask the reader for a file and import what they pick, reporting as start does. On a desktop that is the OS dialog; in a tab it is the page's own chooser, which takes several files at once so a .gltf can be picked with the images it names. Answers whether the asking began.
file(string) -> import::Imported — Import one file into the edited project, in one call. A whole project is the work of seconds, so an editor keeping its frame wants start.
handles(string) -> bool — Whether an importer claims this file, by extension.
running_count() -> int — How many imports are in flight.
start(string, str?) -> bool — Import one file into the edited project, or into project when one is named, a few files per frame, each reported as the import_event event: events::listen(node, "import_event"), heard as on_import_event, as an import starts, writes each file, finishes or fails. Answers false while a recording plays. A model and a sprite are read first and then written a slice at a time; a level walks its own folder and takes one long slice, which says so in files.

Are you sure?