Skip to content

fix: align Lua 5.2 VM equality, modulo and loop rules - #379

Merged
akeit0 merged 1 commit into
mainfrom
codex/pr-lua52-vm-semantics
Oct 27, 2026
Merged

akeit0 merged 1 commit into
mainfrom
codex/pr-lua52-vm-semantics

Conversation

@akeit0

@akeit0 akeit0 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Lua 5.2 only invokes __eq for eligible same-type operands with a shared metamethod. Enforce that rule and skip the slow path for primitive inequality. Use the non-positive-step direction for zero-step numeric loops and the floor-based modulo expression for both execution and constant folding. Convert a numeric __tostring result to one string.

These are semantic alignment changes. Tests cover shared/different equality methods, hooks and suspended callbacks, zero-step loops, and folded/runtime modulo. The full test suite passes on .NET 8/10; CSharpier passes.

@akeit0
akeit0 force-pushed the codex/pr-lua52-vm-semantics branch from 01a99b1 to e5b1f96 Compare October 27, 2026 02:56
@akeit0
akeit0 force-pushed the codex/pr-lua52-vm-semantics branch from e5b1f96 to 737ab3f Compare October 27, 2026 03:11
@akeit0
akeit0 changed the base branch from main to codex/pr-test-fixture-names October 27, 2026 03:11
@akeit0
akeit0 changed the base branch from codex/pr-test-fixture-names to main October 27, 2026 03:28
@akeit0
akeit0 marked this pull request as ready for review October 27, 2026 03:28
@akeit0
akeit0 force-pushed the codex/pr-lua52-vm-semantics branch from 737ab3f to bb83114 Compare October 27, 2026 03:28
@akeit0
akeit0 merged commit ec08d8b into main Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant