summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/sol2/sol/table_core.hpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/sol2/sol/table_core.hpp')
-rw-r--r--3rdparty/sol2/sol/table_core.hpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/3rdparty/sol2/sol/table_core.hpp b/3rdparty/sol2/sol/table_core.hpp
index 107cd19776e..8004ebd2180 100644
--- a/3rdparty/sol2/sol/table_core.hpp
+++ b/3rdparty/sol2/sol/table_core.hpp
@@ -31,8 +31,8 @@
namespace sol {
namespace detail {
template <std::size_t n>
- struct clean { lua_State* L; clean(lua_State* L) : L(L) {} ~clean() { lua_pop(L, static_cast<int>(n)); } };
- struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* L, int& n) : L(L), n(n) {} ~ref_clean() { lua_pop(L, static_cast<int>(n)); } };
+ struct clean { lua_State* L; clean(lua_State* luastate) : L(luastate) {} ~clean() { lua_pop(L, static_cast<int>(n)); } };
+ struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* luastate, int& n) : L(luastate), n(n) {} ~ref_clean() { lua_pop(L, static_cast<int>(n)); } };
inline int fail_on_newindex(lua_State* L) {
return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
}
@@ -49,7 +49,7 @@ namespace sol {
template<typename Fx>
void for_each(std::true_type, Fx&& fx) const {
auto pp = stack::push_pop(*this);
- stack::push(base_t::lua_state(), nil);
+ stack::push(base_t::lua_state(), lua_nil);
while (lua_next(base_t::lua_state(), -2)) {
sol::object key(base_t::lua_state(), -2);
sol::object value(base_t::lua_state(), -1);
@@ -62,7 +62,7 @@ namespace sol {
template<typename Fx>
void for_each(std::false_type, Fx&& fx) const {
auto pp = stack::push_pop(*this);
- stack::push(base_t::lua_state(), nil);
+ stack::push(base_t::lua_state(), lua_nil);
while (lua_next(base_t::lua_state(), -2)) {
sol::object key(base_t::lua_state(), -2);
sol::object value(base_t::lua_state(), -1);
@@ -174,11 +174,19 @@ namespace sol {
basic_table_core& operator=(basic_table_core&&) = default;
basic_table_core(const stack_reference& r) : basic_table_core(r.lua_state(), r.stack_index()) {}
basic_table_core(stack_reference&& r) : basic_table_core(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_table_core(lua_State* L, T&& r) : basic_table_core(L, sol::ref_index(r.registry_index())) {}
basic_table_core(lua_State* L, int index = -1) : base_t(L, index) {
#ifdef SOL_CHECK_ARGUMENTS
stack::check<basic_table_core>(L, index, type_panic);
#endif // Safety
}
+ basic_table_core(lua_State* L, ref_index index) : base_t(L, index) {
+#ifdef SOL_CHECK_ARGUMENTS
+ auto pp = stack::push_pop(*this);
+ stack::check<basic_table_core>(L, -1, type_panic);
+#endif // Safety
+ }
iterator begin() const {
return iterator(*this);
@@ -457,6 +465,10 @@ namespace sol {
static const int narr = static_cast<int>(meta::count_2_for_pack<std::is_integral, Args...>::value);
return create(std::forward<Name>(name), narr, sizeof...(Args) / 2 - narr, std::forward<Args>(args)...);
}
+
+ ~basic_table_core() {
+
+ }
};
} // sol