EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

Hiii bestie, welcome to the EMILUA(3em) page! This is all about Emilua β€” the Lua execution engine. Periodt. πŸ‘‘


✨ SYNOPSIS ✨

format(fmt: string[, ...]) -> string

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so format() takes your args and formats them according to the specifications in fmt, then returns the result as a string. It’s giving β€œbuild the perfect string” main character energy. πŸ’…

Supported arguments:

  • boolean
  • number
  • string

You may also specify pairs. First element must be a string and it works as a named argument. 🫢

The full specification for the format string can be found in the libfmt homepage: https://fmt.dev/latest/syntax.html.

🌸 Note: format() is a global so it doesn’t need to be require()d. No extra steps, bestie β€” it’s just there. ✨

πŸŽ€ EXAMPLE πŸŽ€

format("{0}, {1}, {2}", 'a', 'b', 'c')
-- Result: "a, b, c"

format("{}, {}, {}", 'a', 'b', 'c')
-- Result: "a, b, c"

format("{2}, {1}, {0}", 'a', 'b', 'c')
-- Result: "c, b, a"

format("{0}{1}{0}", "abra", "cad") -- arguments' indices can be repeated
-- Result: "abracadabra"

format("{:.{}f}", 3.14, 1)
-- Result: "3.1"

format("Elapsed time: {s:.2f} seconds", {"s", 1.23})
-- Result: "Elapsed time: 1.23 seconds"

Catch you later, bestie! πŸ’– This iconic page comes from Emilua 0.12.1-nixpkgs1, dated 1980-01-01. Slay. πŸ’…βœ¨

πŸ“¦ where this page comes from