EMILUA(3em)
π 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 berequire()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
- nixos 26.05: emilua 0.12.1
- nixpkgs unstable: emilua 0.12.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms