Conversation
Agent-Logs-Url: https://github.com/kunitoki/LuaBridge3/sessions/0b371b0f-d95d-4e8a-9513-8514e6daa460 Co-authored-by: kunitoki <707032+kunitoki@users.noreply.github.com>
kunitoki
requested changes
Mar 27, 2026
Owner
kunitoki
left a comment
There was a problem hiding this comment.
these changes are unrelated to the requested change
Agent-Logs-Url: https://github.com/kunitoki/LuaBridge3/sessions/0b371b0f-d95d-4e8a-9513-8514e6daa460 Co-authored-by: kunitoki <707032+kunitoki@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for addStaticIndexMetamethod and addStaticNewIndexMetamethod
Add addStaticIndexMetaMethod and addStaticNewIndexMetaMethod to Class<T>
Mar 27, 2026
Agent-Logs-Url: https://github.com/kunitoki/LuaBridge3/sessions/86769b52-8bf9-493e-ae2c-80a5d0fb72f7 Co-authored-by: kunitoki <707032+kunitoki@users.noreply.github.com>
Contributor
Author
The accidentally committed |
Agent-Logs-Url: https://github.com/kunitoki/LuaBridge3/sessions/0b6157c4-c785-4936-b30c-220e2610820b Co-authored-by: kunitoki <707032+kunitoki@users.noreply.github.com>
Copilot
AI
changed the title
Add addStaticIndexMetaMethod and addStaticNewIndexMetaMethod to Class<T>
Add addStaticIndexMetaMethod and addStaticNewIndexMetaMethod to Class
Mar 28, 2026
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.
Extends the
__index/__newindexmetamethod fallback system to the static class table (MyClass.key), which previously had no interception mechanism. Instance-leveladdIndexMetaMethod/addNewIndexMetaMethodwere unaffected.New API
addStaticIndexMetaMethod(fn)— intercepts unknown key reads on the static class table; callback signature(const LuaRef& key, lua_State*) -> LuaRef(noself)addStaticNewIndexMetaMethod(fn)— intercepts unknown key writes; callback signature(const LuaRef& key, const LuaRef& value, lua_State*) -> LuaRefBoth accept a raw function pointer or any callable (lambda with captures, functor).
Implementation
ClassInfo.h—getStaticIndexFallbackKey()/getStaticNewIndexFallbackKey()registry keys, separate from instance fallback keysCFunctions.h—try_call_static_index_fallback()/try_call_static_newindex_fallback(); wired intoindex_metamethod<false>andnewindex_metamethod<false>Namespace.h—addStaticIndexMetaMethod/addStaticNewIndexMetaMethodonClass<T>, each with functor and function-pointer overloadsDistribution/LuaBridge.h— amalgamated header updatedFallback priority
The fallback is consulted first. If it returns nil, normal lookup continues and registered static properties/functions are found as usual. A non-nil return overrides any same-named registered property.
Tests & docs
ClassExtensibleTestscovering both callable forms, nil fall-through to real properties/functions, priority shadowing, standalone newindex, and combined usageManual.md§2.7.3 added with usage examples and priority semantics⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.