canaryThese pages document the canary: an unreleased build. What they describe may not be in the version you have, and may change before it is.The stable build
Try it in your browsercanary Source

Lune's standard library✎

Files, networking, processes and the rest — as two nodes that know every signature.

Pending review

Lune ships its own library: the filesystem, HTTP, child processes, the terminal, a scheduler. Each part is a module you require — @lune/fs, @lune/net — and Roswaal knows all 61 of their functions.

Two nodes, not sixty-one

One node per function would put sixty-odd entries in the palette and a release of Roswaal between you and anything Lune shipped last month. So there are two, and they read a catalogue: Lune Function for a call that does something, Lune Function (Value) for one that answers something.

Lune Function
Lune Function (Value)
Both arrive blank. Pick the call in the Inspector — or search the palette for it by name, and the node comes configured.

The palette still knows every function. Type readFile and fs.readFile is there; picking it places the node already set to that call, with path and the result pin typed from Lune's own signature.

Info

Lune decides which you get, not Roswaal. A function Lune tags must_use is a value; the rest are steps. So fs.readFile is a value and fs.writeFile a step.

The module has to be declared

A Lune Function node does not write its own require. Pick fs.readFile in a script that does not require @lune/fs and the node says so, and the Inspector offers a button that declares it.

Warning

@lune/fs is no exception, though it is always available: placing a node never adds a require. See Modules.

So the button is the whole of the difference: said and offered, never done. Declaring it the moment you picked the call would be the editor expanding what your project depends on without being asked.

luau
local fs = require("@lune/fs")

print(fs.readFile("notes.txt"))

The local is the one you named in the Variables panel. Call it disk and the call reads disk.readFile — see Variables and locals for why the name is yours.

What is in it

ModuleWhat it is forFunctions
@lune/datetimeDates, times and their formats7
@lune/fsThe filesystem11
@lune/luauCompiling and loading Luau at runtime2
@lune/netHTTP, sockets and serving5
@lune/processThis process, and child processes3
@lune/regexRegular expressions1
@lune/robloxRoblox files, instances and datatypes14
@lune/serdeJSON, TOML, YAML and compression6
@lune/stdioThe terminal: input, output and colour7
@lune/taskThe scheduler, and waiting5

A module also hands back types with methods of their own — regex.new gives you a Regex, and its find is asked of that value rather than of the module. Those are Call Method, not these two nodes.

Arguments and results

  • Arguments arrive named and typed from Lune's signature, with Lune's own description on each pin.
  • An optional argument starts empty, so leaving it alone leaves it off the call. task.wait() and task.wait(0) are different calls and you can write either.
  • A type Roswaal's pins cannot say — buffer | string — becomes an any pin whose description gives the real one. A pin claiming string would refuse a buffer the runtime accepts.

Which Lune

Every signature here comes from Lune 0.10.5, read out of the types.d.luau files that ship with it rather than from a page describing them. Moving to a new Lune is npm run build:lune, and the diff is the API change — which is the point of generating it rather than writing it down.

Info

@lune/fs and its siblings cannot be aliased — Lune reserves those names. See Aliases and .luaurc for the ones you can define.

Not reviewed yet