feat(phase-15): Debug library and module registration#139
Merged
davydog187 merged 2 commits intomainfrom Feb 12, 2026
Merged
Conversation
davydog187
commented
Feb 12, 2026
32f80a0 to
391c97a
Compare
davydog187
commented
Feb 12, 2026
lib/lua/vm/stdlib.ex
Outdated
| defp install_library(state, module) do | ||
| state = module.install(state) | ||
|
|
||
| # Derive the library name from the module (e.g., Lua.VM.Stdlib.Math -> "math") |
Contributor
Author
There was a problem hiding this comment.
make this a callback instead of deriving
- New debug library with getinfo, traceback, getmetatable, setmetatable - Stub implementations for getlocal, setlocal, sethook, gethook, getupvalue, setupvalue, upvalueid - Add install_library/2 helper that calls behaviour install/1 and registers module in package.loaded automatically - debug.getmetatable/setmetatable bypass __metatable protection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add lib_name/0 callback to Library behaviour. Each stdlib module declares its own Lua global name, used by install_library/2 for package.loaded registration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8bd4e90 to
daa40e9
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
debuglibrary withgetinfo,traceback,getmetatable,setmetatablegetlocal,setlocal,sethook,gethook,getupvalue,setupvalue,upvalueidpackage.loadedsorequire("string")etc. worksdebug.getmetatable/debug.setmetatablebypass__metatableprotectionTest plan
require "string"/require "math"/require "debug"return correct tables (3 tests)🤖 Generated with Claude Code