feat(phase-16): Complete string.format with width/precision#136
Merged
davydog187 merged 2 commits intomainfrom Feb 12, 2026
Merged
feat(phase-16): Complete string.format with width/precision#136davydog187 merged 2 commits intomainfrom
davydog187 merged 2 commits intomainfrom
Conversation
Rewrite string.format to support full Lua 5.3 format specifiers: - Flags: -, +, space, 0, # - Width and precision modifiers - New specifiers: %g, %G, %e, %E, %u Implements Phase 16 from plan.md
Add 15 property tests covering string.format: Integer formatting: - %d produces correct integer strings - %d truncates floats to integers - %x produces valid lowercase hex (round-trips through Integer.parse) - %X produces valid uppercase hex (round-trips through Integer.parse) - %o produces valid octal (round-trips through Integer.parse) String/char formatting: - %s returns the original string - %c produces single byte for values 0-127 - %% always produces literal percent - %.ns truncates string to at most n characters Width/precision: - Width specifier pads to at least width characters - Left-justify flag makes result left-aligned - Zero-pad flag fills with zeros - %.nf produces exactly n decimal places Scientific notation: - %e always contains e+/e- notation - %E always contains E+/E- notation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4c6644f to
21ca3f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
%[flags][width][.precision]specifier%g/%G(general),%e/%E(scientific),%u(unsigned)%5d,%-10s,%.2f,%05d,%02xTest plan
🤖 Generated with Claude Code