ludic/docs/language/text/text-length.md

724 B

id name category kind tokens sig tip order ns member
text-length Text.length text namespace-method Text.length Text.length(s) -> int The number of bytes in a string. 0 Text length

Returns how many bytes are in s, not counting the terminating zero. It is the same count as the bare len(s), exposed under the Text namespace for discoverability. Use it to size a HUD field, walk a string by index, or check for emptiness with Text.length(s) == 0.

Parameters:

  • s — the string to measure
program NameWidth {
  let label: string = "player one"

  handler Draw phase Render {
    let width = Text.length(label) * 6   # 6 px per glyph
  }
}