This commit is contained in:
ThePhD 2019-09-08 19:54:17 -04:00
parent 29c03ea5cf
commit b2c22ea8fe
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
3 changed files with 28 additions and 16 deletions

View File

@ -318,8 +318,9 @@ namespace sol {
basic_table_core(lua_State* L, T&& r) : base_t(L, std::forward<T>(r)) {
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
constructor_handler handler{};
stack::check<basic_table_core>(lua_state(), -1, handler);
stack::check<basic_table_core>(lua_state(), table_index, handler);
#endif // Safety
}
basic_table_core(lua_State* L, const new_table& nt) : base_t(L, -stack::push(L, nt)) {
@ -336,8 +337,9 @@ namespace sol {
basic_table_core(lua_State* L, ref_index index) : basic_table_core(detail::no_safety, L, index) {
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
constructor_handler handler{};
stack::check<basic_table_core>(lua_state(), -1, handler);
stack::check<basic_table_core>(lua_state(), table_index, handler);
#endif // Safety
}
template <typename T,
@ -347,8 +349,9 @@ namespace sol {
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
if (!is_table<meta::unqualified_t<T>>::value) {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
constructor_handler handler{};
stack::check<basic_table_core>(lua_state(), -1, handler);
stack::check<basic_table_core>(lua_state(), table_index, handler);
}
#endif // Safety
}
@ -535,8 +538,9 @@ namespace sol {
lua_State* L = base_t::lua_state();
if constexpr (std::is_invocable_v<Fx, Key, Value>) {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
stack::push(L, lua_nil);
while (lua_next(L, -2)) {
while (lua_next(L, table_index)) {
Key key(L, -2);
Value value(L, -1);
auto pn = stack::pop_n(L, 1);
@ -545,8 +549,9 @@ namespace sol {
}
else {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
stack::push(L, lua_nil);
while (lua_next(L, -2)) {
while (lua_next(L, table_index)) {
Key key(L, -2);
Value value(L, -1);
auto pn = stack::pop_n(L, 1);
@ -558,8 +563,9 @@ namespace sol {
size_t size() const {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
lua_State* L = base_t::lua_state();
lua_len(L, -1);
lua_len(L, table_index);
return stack::pop<size_t>(L);
}

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2019-09-01 06:26:40.948435 UTC
// This header was generated with sol v3.0.3 (revision e8649d2)
// Generated 2019-09-08 23:53:48.445628 UTC
// This header was generated with sol v3.0.3 (revision 29c03ea)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2019-09-01 06:26:40.339961 UTC
// This header was generated with sol v3.0.3 (revision e8649d2)
// Generated 2019-09-08 23:53:47.830273 UTC
// This header was generated with sol v3.0.3 (revision 29c03ea)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP
@ -23009,8 +23009,9 @@ namespace sol {
basic_table_core(lua_State* L, T&& r) : base_t(L, std::forward<T>(r)) {
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
constructor_handler handler{};
stack::check<basic_table_core>(lua_state(), -1, handler);
stack::check<basic_table_core>(lua_state(), table_index, handler);
#endif // Safety
}
basic_table_core(lua_State* L, const new_table& nt) : base_t(L, -stack::push(L, nt)) {
@ -23027,8 +23028,9 @@ namespace sol {
basic_table_core(lua_State* L, ref_index index) : basic_table_core(detail::no_safety, L, index) {
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
constructor_handler handler{};
stack::check<basic_table_core>(lua_state(), -1, handler);
stack::check<basic_table_core>(lua_state(), table_index, handler);
#endif // Safety
}
template <typename T,
@ -23038,8 +23040,9 @@ namespace sol {
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
if (!is_table<meta::unqualified_t<T>>::value) {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
constructor_handler handler{};
stack::check<basic_table_core>(lua_state(), -1, handler);
stack::check<basic_table_core>(lua_state(), table_index, handler);
}
#endif // Safety
}
@ -23226,8 +23229,9 @@ namespace sol {
lua_State* L = base_t::lua_state();
if constexpr (std::is_invocable_v<Fx, Key, Value>) {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
stack::push(L, lua_nil);
while (lua_next(L, -2)) {
while (lua_next(L, table_index)) {
Key key(L, -2);
Value value(L, -1);
auto pn = stack::pop_n(L, 1);
@ -23236,8 +23240,9 @@ namespace sol {
}
else {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
stack::push(L, lua_nil);
while (lua_next(L, -2)) {
while (lua_next(L, table_index)) {
Key key(L, -2);
Value value(L, -1);
auto pn = stack::pop_n(L, 1);
@ -23249,8 +23254,9 @@ namespace sol {
size_t size() const {
auto pp = stack::push_pop(*this);
int table_index = pp.index_of(*this);
lua_State* L = base_t::lua_state();
lua_len(L, -1);
lua_len(L, table_index);
return stack::pop<size_t>(L);
}