Skip to content

feat: API improvements — ownership, type names, containers, DX helpers - #2

Merged
esrrhs merged 5 commits into
masterfrom
feature/api-improvements
Nov 4, 2026
Merged

esrrhs merged 5 commits into
masterfrom
feature/api-improvements

Conversation

@esrrhs

@esrrhs esrrhs commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Summary

This PR improves bLua's C++ ↔ Lua binding API with ownership control, more stable type names, container helpers, and several DX registrations. CI is expanded to cover Windows and LuaJIT alongside existing Linux/macOS matrices.

Improvements

  1. Ownership control for class userdata __gc — configurable owning / non-owning / custom deleter
  2. Stable metatable names — user-provided names with demangled typeid fallback
  3. vector / map ↔ Lua table helpers — bidirectional conversion utilities
  4. reg_constructor — register constructors on class bindings
  5. reg_property — register property-style getters/setters
  6. reg_enum / reg_global_overload — enum registration and global overload support
  7. native_to_lua(const char*) nullptr → nil — safer nullptr handling; drop unused iostream

Tests

  • New/expanded coverage for ownership, type errors, nullptr, multi-return, and the new APIs (test/test.cpp)
  • Local author: esrrhs <esrrhs@163.com>
  • CI workflow (.github/workflows/c-cpp.yml) now includes:
    • Linux: gcc/clang × Lua 5.3/5.4
    • Linux LuaJIT
    • macOS (Homebrew Lua)
    • Windows (vcpkg Lua)

Docs

  • README / README_CN updated for new APIs and Lua matrix
  • CHANGELOG prepared for a future release (do not tag without approval)

Checklist

  • Feature commits + tests + docs
  • CI: Windows + LuaJIT added
  • CI green on this PR (watching)

- Configurable owning / non-owning / custom deleter for class userdata __gc
- Stable metatable names (user-provided, demangled typeid fallback)
- vector/map <-> Lua table helpers
- reg_constructor, reg_property, reg_enum, reg_global_overload
- native_to_lua(const char*) nullptr -> nil; drop unused iostream
Prepare CHANGELOG for a future release; do not tag without approval.
- Point CMake at LuaJIT via pkg-config (FindLua misses luajit-5.1).
- Resolve vcpkg toolchain with Join-Path / C:/vcpkg fallback so
  CMAKE_TOOLCHAIN_FILE is a real path under PowerShell.
Emulate Lua 5.2+ return codes for lua_getfield, lua_rawgetp, and
luaL_getmetatable so comparisons like != LUA_TTABLE compile on LuaJIT.
@esrrhs
esrrhs merged commit 38c06b9 into master Nov 4, 2026
7 checks passed
@esrrhs
esrrhs deleted the feature/api-improvements branch November 4, 2026 04:03
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