Namespace Apogee.Scripting¶
Classes¶
What a host adds to or takes out of the definitions.
Writes the engine's API as Luau type definitions (apogee.d.luau) for luau-lsp, from the registry: the classes, enums and script
libraries the generator described, and the hand-written natives with the declarations they were registered with. The output depends only on
the registry, in a fixed order.
The easing functions (Robert Penner's set, written from the formulas).
A global that the host sets in its VMs (
Reloads what changed on disk while the game runs (a development run, the editor). .luau file that a script has required is a module reload (defs.on_change listeners are called); an image or model is imported again (when the project has been imported: imported/index.xml) and .slang file raises mod.xml, a script that only runs once) is listed in
Runs the *.test.luau files under a folder, each in a VM of its own (so one file's globals, modules and worlds cannot touch
another's). A file's describe bodies run as it loads; its cases then run in order, one frame at a time, with @engine/test.
One Luau VM for the game and its mods. Every script runs in a thread of its own with its own globals over the read-only ones
(luaL_sandbox), and belongs to a
What
Runs the packages of a
@<id>/…as arequirealias for each package, so that a mod can use a dependency's modules;- confinement: a mod may
requirefiles of its own package and of the packages it depends on (andres://), nothing else; - the
fslibrary with the same rules: a mod readsres://, its own package, its dependencies', anduser://moddata/<id>/, and writes onlyuser://moddata/<id>/; - modules that run as the owner of the package they are in, whoever required them.
A script that fails stops its package (the error is logged and in the result), and what depends on it is not run; it never stops the game. Content the package brought stays loaded.
What happened to a package's scripts.
Scripts from a folder of the real file system.
Writes the engine's Luau API as Markdown pages for the Manual (--luau-docs), from the same registry as classes/Name.md), one per script library (libraries/name.md), one for all enums (enums.md) and reference.md, which lists everything with the host's globals.
The output depends only on the registry, in a fixed order, with \n line ends.
What one
A script failed. The message is the script's, with its traceback for a runtime error.
Methods of a class that are written by hand against the Luau stack because they take tables, functions or variable shapes that the
registry cannot describe (the ECS calls on World). A native sees the stack as a method does: the object at index 1, then the
arguments; it returns the number of results it pushed, and throws a .d.luau declaration, so the definitions cannot lack one.
Whose code is running: the base game or one mod. Everything an owner's scripts allocate is counted in the owner's memory category of the VM, and its calls get the owner's time budget, so one mod cannot use up the memory or the frame of the others.
The tasks of one VM (and its tweens, which it steps and cancels along with them): what task.spawn, task.defer, task.delay and task.every start, and what task.wait puts to sleep. A task is a Luau thread the scheduler
resumes: at once (spawn), at the next drain (defer), when its time comes (delay, wait, every). There is no clock in here:
An animation that tween.value, tween.property and tween.field start: a number, a vector, a colour (a linear-RGB vector) or a rotation (slerped) moving from one value to another over some
seconds, with an easing curve. It plays by itself, on the game clock (or the real clock with the unscaled option), stepped by
Scripts from the content file system: res://main.luau, mod://my_mod/ui.luau. Give it to
Interfaces¶
Where scripts are read from. The VM only sees paths with / as the separator, plain ones or res://-style ones;
Enums¶
The easing curves of tween: how the progress of a tween (0 to 1 in time) maps to the progress of its value. Scripts name them in snake_case (quad_in_out). The
In curves start slowly, the Out ones end slowly and the InOut ones do both. Back, Elastic and Bounce go past the ends of the range on the way.