summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/sol2/sol/userdata.hpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/sol2/sol/userdata.hpp')
-rw-r--r--3rdparty/sol2/sol/userdata.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/3rdparty/sol2/sol/userdata.hpp b/3rdparty/sol2/sol/userdata.hpp
index 6a4098f1a0a..382f89b17da 100644
--- a/3rdparty/sol2/sol/userdata.hpp
+++ b/3rdparty/sol2/sol/userdata.hpp
@@ -44,11 +44,19 @@ namespace sol {
basic_userdata& operator=(basic_userdata&&) = default;
basic_userdata(const stack_reference& r) : basic_userdata(r.lua_state(), r.stack_index()) {}
basic_userdata(stack_reference&& r) : basic_userdata(r.lua_state(), r.stack_index()) {}
+ template <typename T, meta::enable<meta::neg<std::is_integral<meta::unqualified_t<T>>>, meta::neg<std::is_same<T, ref_index>>> = meta::enabler>
+ basic_userdata(lua_State* L, T&& r) : basic_userdata(L, sol::ref_index(r.registry_index())) {}
basic_userdata(lua_State* L, int index = -1) : base_t(L, index) {
#ifdef SOL_CHECK_ARGUMENTS
type_assert(L, index, type::userdata);
#endif // Safety
}
+ basic_userdata(lua_State* L, ref_index index) : base_t(L, index) {
+#ifdef SOL_CHECK_ARGUMENTS
+ auto pp = stack::push_pop(*this);
+ type_assert(L, -1, type::userdata);
+#endif // Safety
+ }
};
template <typename base_t>
@@ -70,11 +78,19 @@ namespace sol {
basic_lightuserdata& operator=(basic_lightuserdata&&) = default;
basic_lightuserdata(const stack_reference& r) : basic_lightuserdata(r.lua_state(), r.stack_index()) {}
basic_lightuserdata(stack_reference&& r) : basic_lightuserdata(r.lua_state(), r.stack_index()) {}
+ template <typename T, meta::enable<meta::neg<std::is_integral<meta::unqualified_t<T>>>, meta::neg<std::is_same<T, ref_index>>> = meta::enabler>
+ basic_lightuserdata(lua_State* L, T&& r) : basic_lightuserdata(L, sol::ref_index(r.registry_index())) {}
basic_lightuserdata(lua_State* L, int index = -1) : base_t(L, index) {
#ifdef SOL_CHECK_ARGUMENTS
type_assert(L, index, type::lightuserdata);
#endif // Safety
}
+ basic_lightuserdata(lua_State* L, ref_index index) : base_t(L, index) {
+#ifdef SOL_CHECK_ARGUMENTS
+ auto pp = stack::push_pop(*this);
+ type_assert(L, -1, type::lightuserdata);
+#endif // Safety
+ }
};
} // sol