You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
string.format does not support precision specifiers (%.2f, %05d, etc.) #148
Severity: Medium Area: Standard library — lib/lua/vm/stdlib/string.ex
Description
string.format raises "bad argument to 'string.format' (invalid option '%.')" when given format specifiers with precision (e.g., %.2f) or width-and-precision combinations. Standard Lua 5.3/5.4 supports the full C printf-style format string syntax.
Reproduction
returnstring.format("%.2f", 3.14159)
-- Expected: "3.14"-- Actual: ** (Lua.RuntimeException) bad argument to 'string.format' (invalid option '%.')
Workaround
Use %f (full float) or convert manually with math.floor / string concatenation.
Summary Table
#
Bug
Severity
Status
1
local function declarations silently dropped
High
Open
2
function Table.method() dot-syntax fails at runtime
High
Open
3
Multiple for loops with the same variable name corrupt register allocation
High
Open
4
Register overlap in nested functions causes infinite for loops
Critical
Fixed
5
string.format does not support precision specifiers
Activity
davydog187 commentedon May 4, 2026
This was fixed in PR #136 (Phase 16 — string.format width/precision).
Verified on
main(835de36):Closing as resolved.