Respec #
Respec, from "Relative Formspec", is a formspec library for Luanti.
Respec suppots all features from the Luanti Formspec API with two trivial exceptions (see at bottom)
Respec provides:
- Easy and versatile method of positioning and sizing of elements
- Auto-sizing for some text elements
- Easy callbacks for interactive elements
- Quality-of-life features to decrease how much code has to be written
Respec's system of positioning and sizing of elements uses relative positioning, which is inspired by and strongly based on Android's Constraint Layout, with which Respec shares many similarities (e.g. chains).
However knowledge of Android or Constraint Layout is not required.
Getting Started #
Getting Started, with examples - on the Github Wiki
API #
The API docs can be read online here.
Unsupported Formspec Elements #
-
real_coordinates[<bool>]
Reason: This is set totrue
by default past formspec v2, and Respec's layout algorithm is build with the assumption that this is always enabled. There is also no functional difference in what can be achieved with formspecs by not supporting this element, so Respec assumes real coordinates are always on, and turning them off is not supported. -
Size-less
field[]
Reason: This element only has an edge-case usage for trivial forms that don't require any laying out of elements. Note that regularfield[]
elements and all their functionalities are fully supported.