Files
moonwell-client-core/crates/benilla-lua
Sam Sung f9889a3c9d lua: keep ipairs' global name alive through a collection (#2998)
`ipairs(t)` answered nil once a script had cleared the global `ipairs`, a collection had run, and the global was set again.

The reference reads the global `ipairs` raw as the loop's iterator (`0x702d15`), by name. We read it by a string id interned once at start, but the collector's root list of those names was kept by hand and left `ipairs` out. A collection could free the string, and setting the global again interned it under a new id.

`Names::all` now lists every field through an exhaustive pattern, and the collector roots that list, so a name added later does not compile until it is rooted.

Test: `ipairs_finds_its_global_after_it_is_cleared_and_collected` runs the issue's sequence. It answers nil without the fix and the function with it.

Fixes #2974

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 21:27:46 +07:00
..