Skip to content

fix: balance Lua module loader stack - #76

Closed
nkbeast wants to merge 1 commit into
doriaxengine:mainfrom
nkbeast:fix/balance-lua-module-loader-stack
Closed

fix: balance Lua module loader stack#76
nkbeast wants to merge 1 commit into
doriaxengine:mainfrom
nkbeast:fix/balance-lua-module-loader-stack

Conversation

@nkbeast

@nkbeast nkbeast commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • copy the normalized module name out of Lua before constructing lookup paths
  • pop the temporary luaL_gsub result from the Lua stack
  • use the stable module name for both lookup fallbacks

Validation

  • module-loader source assertions passed
  • git diff --check — passed

@eduardodoria

Copy link
Copy Markdown
Contributor

Two commits on main already cover the module loader, both landing after this PR's base: c1594c3 reordered the lookup fallbacks, and fc1815d fixed the std::to_string(char) separator bug.

This PR's diff still carries the old std::to_string form, which is where the conflict comes from.

@nkbeast

nkbeast commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the pointers, both commits are in now — kept your separator fix and the lookup order as is.

What's left in this PR is just the stack balance: luaL_gsub pushes the substituted name onto the Lua stack and nothing popped it, so every require() left one slot behind. The name is copied into a std::string before the pop so the pointer stays valid afterwards.

@nkbeast
nkbeast force-pushed the fix/balance-lua-module-loader-stack branch from b81cb17 to 6693ae1 Compare September 3, 2026 17:21
@nkbeast

nkbeast commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing this — your two commits covered the real problems here, and looking at the rebased diff the only thing left was the luaL_gsub pop, which the normal require cleanup already handles anyway. Thanks for the quick pointers on which commits landed.

@nkbeast nkbeast closed this Sep 3, 2026
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.

2 participants