welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
metamethods.hpp File Reference

The C++-operator → sol2 metamethod map, factored out of the sol2 backend. More...

#include <meta>
#include <welder/bind_traits.hpp>
#include <welder/rods/lua/metamethods.hpp>
#include <sol/sol.hpp>
Include dependency graph for metamethods.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  welder::rods::sol2::metamethod
 A member operator's sol2 metamethod, or {…, nullptr} if welder does not expose it. More...

Namespaces

namespace  welder
namespace  welder::rods
namespace  welder::rods::sol2

Functions

consteval metamethod welder::rods::sol2::operator_mm (std::meta::info f)
 Map a member operator to its sol2 metamethod ({…, nullptr} = not exposed).

Detailed Description

The C++-operator → sol2 metamethod map, factored out of the sol2 backend.

Which operators Lua exposes, and under what __name, is shared with the LuaBridge3 rod in welder::rods::lua::lua_metamethod_name (Lua's metamethod model is one set of slots, independent of the C++ wrapper). This header adds only the sol2-specific half: the sol::meta_function slot each __name registers through. The backend calls welder::rods::sol2::operator_mm from its special_method_name (the __name, sourced from the shared map, that gates operator eligibility) and its add_operator (the sol::meta_function slot).

Requires the welder vocabulary first (#include <welder/vocabulary.hpp>) and <sol/sol.hpp>.

Definition in file metamethods.hpp.