#About files and modules
Each .lum file in your mod's source folder is one module. This page describes how modules, use lines and library mods work.
A source file is UTF-8 text with the extension
.lum. One file is one module; its name is its path in the mod'ssource/folder without the extension, with/between parts (source/ball/fly.lumisball/fly).usebrings a module into scope:Form What use ./ball/flyanother module of the same mod (path from source/)use kit.actora LumaKit module (or any library mod's module, use <mod id>.<module>, which must be aneedsof the mod)use svc.net.locala service: its functions and events use c "helpers.h"C declarations from the mod's own C sources The game is always in scope; it is not
used.use x as yrenames;use x.{a, b}takes names.A name declared
pubis visible to modules thatusethis one; anything else is private to its file.The mod's entry is the module
main(source/main.lum). Its top-levelon start, hooks and states are the mod's own; other modules' top-level hooks are the mod's too (a hook is never private).
#Library mods
A library mod offers modules to other mods. A mod uses one with use <mod id>.<module>, and the library must be in the needs of the mod's luma.json. LumaKit is such a library: its modules are used as use kit.<module>.
- A name the library declares
pubis visible to the mods that use the module. - A library's
pub taskis exported. The caller gets the task's handle, andwaitcopies the result into the caller's memory. - The library's service calls are its own. A request made inside an export is answered to the library.
on mods.stopped(gone), with its parameter untyped oru64, runs in the library when a mod that called its exports stops. Use it to end what that mod started. Themodsservice's own STOPPED event is writtenon mods.stopped(e: mods.StoppedEvent).