Skip to content

feat(phase-15): Debug library and module registration#139

Merged
davydog187 merged 2 commits intomainfrom
phase-15-debug-modules
Feb 12, 2026
Merged

feat(phase-15): Debug library and module registration#139
davydog187 merged 2 commits intomainfrom
phase-15-debug-modules

Conversation

@davydog187
Copy link
Contributor

Summary

  • New debug library with getinfo, traceback, getmetatable, setmetatable
  • Stub implementations for getlocal, setlocal, sethook, gethook, getupvalue, setupvalue, upvalueid
  • Register string, math, table, debug in package.loaded so require("string") etc. works
  • debug.getmetatable/debug.setmetatable bypass __metatable protection

Test plan

  • debug.getinfo on native and Lua functions (2 tests)
  • debug.traceback producing a string with message (2 tests)
  • debug.getmetatable bypassing __metatable protection (1 test)
  • debug stubs work without error (1 test)
  • require "string" / require "math" / require "debug" return correct tables (3 tests)
  • 1224 tests, 0 failures, 35 skipped

🤖 Generated with Claude Code

@davydog187 davydog187 force-pushed the phase-15-debug-modules branch from 32f80a0 to 391c97a Compare February 12, 2026 21:16
defp install_library(state, module) do
state = module.install(state)

# Derive the library name from the module (e.g., Lua.VM.Stdlib.Math -> "math")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a callback instead of deriving

Dave Lucia and others added 2 commits February 12, 2026 13:55
- 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>
@davydog187 davydog187 force-pushed the phase-15-debug-modules branch from 8bd4e90 to daa40e9 Compare February 12, 2026 21:56
@davydog187 davydog187 merged commit b2c793a into main Feb 12, 2026
2 checks passed
@davydog187 davydog187 deleted the phase-15-debug-modules branch February 12, 2026 22:07
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