diff --git a/examples/archive.luau b/examples/archive.luau index 2d36ffa..a2c372c 100644 --- a/examples/archive.luau +++ b/examples/archive.luau @@ -1,5 +1,4 @@ --- examples/archive.luau: builds a zip, lists and reads it, edits it, converts it to a .tar.gz and back, and gzips a --- single file. Run from the repository root: luau examples/archive.luau (docs/guide/archive.md explains the API). +-- examples/archive.luau: build, read and edit a zip, convert it to .tar.gz and back, gzip a file (docs/guide/archive.md). local F = require("@rosetta") -- a new zip: a directory, a text file, an incompressible file stored as is @@ -16,7 +15,6 @@ zip:add("game/noise.bin", noise, { method = "store" }) local zipBytes = assert(F.save(zip, nil, { format = "zip", comment = "example" })) print(string.format("zip: %d bytes", buffer.len(zipBytes))) --- list and read local loaded = assert(F.archive.load(zipBytes)) for _, e in loaded:list() do print(string.format(" %-18s %6d -> %6s %s", e.name, e.size, tostring(e.compressedSize), e.method or (if e.dir then "dir" else ""))) diff --git a/examples/audio.luau b/examples/audio.luau index 57ee594..feec73e 100644 --- a/examples/audio.luau +++ b/examples/audio.luau @@ -1,5 +1,4 @@ --- Audio example (rosetta): build a sound, edit it with F.ops.audio, encode it to several formats, then stream it --- back with a Decoder. Run from the repository root: luau examples/audio.luau (docs/guide/audio.md explains the API). +-- examples/audio.luau: build a sound, edit it, encode it to several formats, stream it back (docs/guide/audio.md). local F = require("@rosetta") local A = F.ops.audio diff --git a/examples/cad.luau b/examples/cad.luau index 1437b43..b7cfa38 100644 --- a/examples/cad.luau +++ b/examples/cad.luau @@ -1,6 +1,5 @@ --- examples/cad.luau: reads a small STEP file, walks its entity graph (references, complex instances), adds an entity --- and writes it back under another schema. Run from the repository root: luau examples/cad.luau --- Solid geometry (B-rep bodies, meshes) needs a kernel plug-in, F.plugins.brep: see docs/guide/cad.md. +-- examples/cad.luau: read a STEP file, walk its entity graph, add an entity, write it as AP242 (docs/guide/cad.md). +-- Solid geometry (B-rep bodies, meshes) needs a kernel plug-in, F.plugins.brep. local F = require("@rosetta") local STEP = [[ @@ -54,7 +53,6 @@ local si = assert(step.part(cad.entities[20], "SI_UNIT")) print("length unit:", si[1].enum, si[2].enum) -- MILLI METRE assert(si[1].enum == "MILLI") --- the product name local product = cad.entities[step.byType(cad, "PRODUCT")[1]] print("product:", product.args[1], product.args[2]) diff --git a/examples/data.luau b/examples/data.luau index a20c524..83cf206 100644 --- a/examples/data.luau +++ b/examples/data.luau @@ -1,5 +1,4 @@ --- examples/data.luau: one record through JSON, YAML, TOML, MessagePack and CBOR, plus CSV rows, an INI file and an --- XML document. Run from the repository root: luau examples/data.luau (docs/guide/data.md explains the values). +-- examples/data.luau: one record through JSON, YAML, TOML, MessagePack and CBOR; CSV, INI and XML (docs/guide/data.md). local F = require("@rosetta") local Types = F.Types diff --git a/examples/font.luau b/examples/font.luau index 0aa42c6..c162f1d 100644 --- a/examples/font.luau +++ b/examples/font.luau @@ -1,7 +1,5 @@ --- examples/font.luau: loads a TrueType font, prints its metrics, renders a line of text into a PNG and bakes the font --- into a BMFont (descriptor + page images). Run from the repository root: luau examples/font.luau --- It needs a .ttf: from the repo it uses the docs test font (generate it first with python3 -I tools/fixtures.py docs), --- elsewhere set TTF_BYTES below to the bytes of any font (the luau CLI cannot read files). docs/guide/font.md explains. +-- examples/font.luau: load a TrueType font, render text into a PNG, bake a BMFont (docs/guide/font.md). +-- Needs a .ttf: in the repo, the docs test font (python3 -I tools/fixtures.py docs); elsewhere set TTF_BYTES below. local F = require("@rosetta") local TTF_BYTES: buffer? = nil diff --git a/examples/image.luau b/examples/image.luau index 7680994..3ec3080 100644 --- a/examples/image.luau +++ b/examples/image.luau @@ -1,6 +1,5 @@ --- examples/image.luau: build an image, edit it with F.ops.image, save it in several formats, make an animated GIF and --- read it back. Run from the repository root: luau examples/image.luau (the .luaurc alias @rosetta points at src/). --- On LuaJIT / LÖVE, the same calls work with local F = require("rosetta") (docs/guide/image.md). +-- examples/image.luau: build an image, edit it, save it in several formats, make an animated GIF (docs/guide/image.md). +-- On LuaJIT / LÖVE: local F = require("rosetta"). local F = require("@rosetta") local I = F.ops.image diff --git a/examples/layered.luau b/examples/layered.luau index a70d490..8691935 100644 --- a/examples/layered.luau +++ b/examples/layered.luau @@ -1,6 +1,4 @@ --- examples/layered.luau: build a layered document (a group, a clipping layer, a blend mode), flatten it, save it as --- PSD and Aseprite, and make a small Aseprite animation exported as a GIF. Run from the repository root: --- luau examples/layered.luau (docs/guide/layered.md explains the type). +-- examples/layered.luau: build a layered document, flatten it, save PSD and Aseprite, export a GIF (docs/guide/layered.md). local F = require("@rosetta") local I, L = F.ops.image, F.Types.Layered diff --git a/examples/music.luau b/examples/music.luau index 99769ca..3bf186c 100644 --- a/examples/music.luau +++ b/examples/music.luau @@ -1,6 +1,4 @@ --- Music example (rosetta): write a MIDI file from scratch, read it back, and render it to audio with the built-in --- waveforms (pass a SoundFont as { soundfont = sf2Bytes } for real instruments). Run from the repository root: --- luau examples/music.luau (docs/guide/music.md explains the API). +-- examples/music.luau: write a MIDI file, read it back, render it to audio (docs/guide/music.md). local F = require("@rosetta") -- 1. a Midi: 480 ticks per quarter note, absolute ticks, a tempo, a track name and a little melody diff --git a/examples/playlist.luau b/examples/playlist.luau index 1e931fa..cb38c67 100644 --- a/examples/playlist.luau +++ b/examples/playlist.luau @@ -1,5 +1,4 @@ --- examples/playlist.luau: reads an M3U with a base URL, inspects an HLS master playlist, and converts a playlist to --- PLS and XSPF. Run from the repository root: luau examples/playlist.luau (docs/guide/playlist.md explains the type). +-- examples/playlist.luau: read an M3U, inspect an HLS master playlist, convert to PLS and XSPF (docs/guide/playlist.md). local F = require("@rosetta") local M3U = "#EXTM3U\n#PLAYLIST:Road Trip\n#EXTINF:215,Ada - First Song\nmusic/first.mp3\n" diff --git a/examples/scene.luau b/examples/scene.luau index d8d2565..034d122 100644 --- a/examples/scene.luau +++ b/examples/scene.luau @@ -1,6 +1,4 @@ --- examples/scene.luau: builds a 3D scene from scratch (a cube with a material, plus a voxel grid), edits it with --- F.ops.mesh and saves it as GLB, OBJ + MTL and STL. Run from the repository root: luau examples/scene.luau --- (docs/guide/scene.md explains the Scene type). +-- examples/scene.luau: build a 3D scene and a voxel grid, edit it, save as GLB, OBJ and STL (docs/guide/scene.md). local F = require("@rosetta") local S = F.Types.Scene diff --git a/examples/tilemap.luau b/examples/tilemap.luau index ddd7778..e4c5322 100644 --- a/examples/tilemap.luau +++ b/examples/tilemap.luau @@ -1,5 +1,4 @@ --- examples/tilemap.luau: read a Tiled map (TMX), walk its tile layer with the flip flags, find an object, edit the map --- and convert it to TMJ. Run from the repository root: luau examples/tilemap.luau (docs/guide/tilemap.md). +-- examples/tilemap.luau: read a TMX map, walk a tile layer, find an object, edit, write TMJ (docs/guide/tilemap.md). local F = require("@rosetta") local tmx = [[ diff --git a/examples/vector.luau b/examples/vector.luau index 9b584ab..4d479f7 100644 --- a/examples/vector.luau +++ b/examples/vector.luau @@ -1,5 +1,4 @@ --- examples/vector.luau: parse an SVG, inspect its paths, rasterize it at two sizes, build a Vector from scratch and --- write it as SVG. Run from the repository root: luau examples/vector.luau (docs/guide/vector.md explains the type). +-- examples/vector.luau: parse an SVG, rasterize it, build a Vector and write it as SVG (docs/guide/vector.md). local F = require("@rosetta") local svg = [[ diff --git a/examples/video.luau b/examples/video.luau index b61dd19..be70380 100644 --- a/examples/video.luau +++ b/examples/video.luau @@ -1,6 +1,4 @@ --- Video example (rosetta): make frames with F.ops.image, write them as an AVI (Motion-JPEG), then open the --- video, walk its packets and frames, seek, and turn it into an animated GIF. Run from the repository root: --- luau examples/video.luau (docs/guide/video.md explains the API). +-- examples/video.luau: write frames as an MJPEG AVI, open it, walk packets and frames, seek, make a GIF (docs/guide/video.md). local F = require("@rosetta") local I = F.ops.image