LuaRef::getPointer implementation - #259
Merged
Merged
Conversation
kunitoki
force-pushed
the
dev/function_as_arguments
branch
from
July 16, 2026 15:12
dd39388 to
4b61493
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.
This pull request updates the macOS GitHub Actions workflow and improves the
LuaRef::getPointer()method in the LuaBridge codebase. The workflow now uses the correct method to determine the number of CPU cores on macOS, and thegetPointer()method is enhanced to better handle Lua userdata and registered classes. Additional unit tests have been added to ensure correct behavior ofgetPointer()across various Lua types.GitHub Actions Workflow Improvements:
$(nproc)with$(sysctl -n hw.ncpu)in.github/workflows/build_macos.ymlto correctly determine the number of CPU cores on macOS for parallel builds and tests. This change is applied for all Lua, LuaJIT, Luau, and Ravi build and test jobs across C++17, C++20, and C++23 configurations. [1] [2] [3] [4] [5] [6] [7] [8]LuaRef Enhancements:
LuaRef::getPointer()implementation to correctly retrieve pointers for LuaBridge-registered userdata types by checking for a LuaBridge-specific metatable key and extracting the actual pointer from the internal userdata structure.getPointer()to reserve more slots for internal operations, improving safety when stack space is low.Testing Improvements:
LuaRef::getPointer()covering default-constructed refs, nil, booleans, numbers, strings, tables, functions, light userdata, regular userdata, registered classes, and Lua threads. Also includes tests for stack overflow scenarios when safe stack checks are enabled.Internal Code Quality:
Userdata::getPointer()method public for better access in type extraction logic, and moved the constructor back to protected for proper encapsulation.detail::unreachable()afterlua_error()to indicate to the compiler that the function does not return, improving code correctness and optimization. [1] [2]