std.txt.indent_lines

std.txt

indent_lines(input, ind, exclude) -> indented

Indent an array of lines by a given amount

When indent is a number, prepends \027[0m followed by that many spaces to each line (the reset escape prevents colour bleed). When indent is a string, it is used verbatim as the prefix. A value of 0 returns the input unchanged.

exclude is a table whose keys are 1-based line indices; those lines are copied through without indentation. Example: {[1] = true} skips the first line.

input may be either an array of strings or a raw string (which is split on newlines first).