示例工程 11-formatting-and-bytes
11-formatting-and-bytes/01-format-specifiers/README.md
# 01 · format-specifiers
**演示**:`%04x`、`%.2f`、`%8s` 的宽度/精度/进制。
**运行时**:`lua54`、`luajit`。
**运行**:
```sh
.tools/bin/lua54 scripts/run-example.lua examples/11-formatting-and-bytes/01-format-specifiers
.tools/bin/lua54 scripts/test-example.lua examples/11-formatting-and-bytes/01-format-specifiers
```
**预期输出**(lua 5.4.9 / macOS arm64):
```text
hex=00ff
float=3.14
padded=" hi"
```
**看点**:`%q` 会让输出可粘贴回 Lua 源码。
**注意**:`%d` 只接受整数(5.4 拒绝 1.5)。