Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nx.align

nx.align.left(line, width)

nx.align.left(line, width): pad line on the RIGHT with spaces so it spans width display cells, keeping the text flush left. A line already at or wider than width is returned unchanged — it only adds spaces, never truncates. Width is measured with nx.str.width, so wide (CJK / emoji) glyphs pad correctly.

Defined in stdlib.lua.

nx.align.right(line, width)

nx.align.right(line, width): like nx.align.left, but pads on the LEFT so the text sits flush right within width display cells. At or over width → returned unchanged; cell-width aware (nx.str.width).

Defined in stdlib.lua.

nx.align.center(line, width)

nx.align.center(line, width): like nx.align.left, but splits the padding so the text is centred within width display cells; an odd leftover cell goes to the right. At or over width → returned unchanged; cell-width aware (nx.str.width).

Defined in stdlib.lua.