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

860 B

id name category kind tokens sig tip order ns member
text-from_int Text.from_int text namespace-method Text.from_int Text.from_int(n) -> string Render an integer as a string. 10 Text from_int

Returns the decimal text of the integer n — Text.from_int(1234) is "1234", and negatives keep their sign. It is the same conversion as the bare string(n) and the inverse of Text.to_int. Use it when you need a number as characters — to measure its width, concatenate it, or store it — though drawing a number to the screen is better done with Screen.draw_number.

Parameters:

  • n — the integer to render
program ScoreLabel {
  let score: int = 1500

  handler Build phase Update {
    let label = Text.concat("score: ", Text.from_int(score))
  }
}