one day, i'll make a commit and it'll work first try

This commit is contained in:
ThePhD 2017-09-05 23:06:02 -04:00
parent fc91147edc
commit adff0ccbce
6 changed files with 19 additions and 18 deletions

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2017-09-06 01:05:13.658647 UTC // Generated 2017-09-06 03:05:33.019474 UTC
// This header was generated with sol v2.18.2 (revision eb313eb) // This header was generated with sol v2.18.2 (revision fc91147)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -14933,7 +14933,7 @@ namespace sol {
void* baseclasscheck; void* baseclasscheck;
void* baseclasscast; void* baseclasscast;
bool secondarymeta; bool secondarymeta;
std::array<bool, 30> properties; std::array<bool, 31> properties;
template <std::size_t Idx, meta::enable<std::is_same<lua_CFunction, meta::unqualified_tuple_element<Idx + 1, RawTuple>>> = meta::enabler> template <std::size_t Idx, meta::enable<std::is_same<lua_CFunction, meta::unqualified_tuple_element<Idx + 1, RawTuple>>> = meta::enabler>
lua_CFunction make_func() const { lua_CFunction make_func() const {
@ -15274,6 +15274,7 @@ namespace sol {
// for call constructor purposes and such // for call constructor purposes and such
lua_createtable(L, 0, 3); lua_createtable(L, 0, 3);
stack_reference metabehind(L, -1); stack_reference metabehind(L, -1);
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
if (um.callconstructfunc != nullptr) { if (um.callconstructfunc != nullptr) {
stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index()); stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index());
} }
@ -15282,7 +15283,6 @@ namespace sol {
stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc)), metabehind.stack_index()); stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc)), metabehind.stack_index());
} }
// type information needs to be present on the behind-tables too // type information needs to be present on the behind-tables too
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
stack::set_field(L, metatable_key, metabehind, t.stack_index()); stack::set_field(L, metatable_key, metabehind, t.stack_index());
metabehind.pop(); metabehind.pop();
@ -15302,6 +15302,8 @@ namespace sol {
{ {
lua_createtable(L, 0, 3); lua_createtable(L, 0, 3);
stack_reference metabehind(L, -1); stack_reference metabehind(L, -1);
// type information needs to be present on the behind-tables too
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
if (um.callconstructfunc != nullptr) { if (um.callconstructfunc != nullptr) {
stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index()); stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index());
} }
@ -15309,8 +15311,6 @@ namespace sol {
stack::set_field(L, meta_function::index, make_closure(umt_t::index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index()); stack::set_field(L, meta_function::index, make_closure(umt_t::index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index());
stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index()); stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index());
stack::set_field(L, metatable_key, metabehind, t.stack_index()); stack::set_field(L, metatable_key, metabehind, t.stack_index());
// type information needs to be present on the behind-tables too
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
metabehind.pop(); metabehind.pop();
} }
@ -15484,7 +15484,7 @@ namespace sol {
void* baseclasscast; void* baseclasscast;
bool mustindex; bool mustindex;
bool secondarymeta; bool secondarymeta;
std::array<bool, 30> properties; std::array<bool, 31> properties;
template <typename N> template <typename N>
void insert(N&& n, object&& o) { void insert(N&& n, object&& o) {
@ -15783,7 +15783,7 @@ namespace sol {
auto& second = std::get<1>(kvp); auto& second = std::get<1>(kvp);
register_kvp(i, t, first, second); register_kvp(i, t, first, second);
} }
luaL_Reg opregs[32]{}; luaL_Reg opregs[34]{};
int opregsindex = 0; int opregsindex = 0;
auto prop_fx = [&](meta_function mf) { return !properties[static_cast<int>(mf)]; }; auto prop_fx = [&](meta_function mf) { return !properties[static_cast<int>(mf)]; };
usertype_detail::insert_default_registrations<T>(opregs, opregsindex, prop_fx); usertype_detail::insert_default_registrations<T>(opregs, opregsindex, prop_fx);
@ -15849,6 +15849,7 @@ namespace sol {
luaL_newmetatable(L, &usertype_traits<T>::user_metatable()[0]); luaL_newmetatable(L, &usertype_traits<T>::user_metatable()[0]);
stack_reference t(L, -1); stack_reference t(L, -1);
stack::set_field(L, meta_function::type, type_table, t.stack_index()); stack::set_field(L, meta_function::type, type_table, t.stack_index());
for (auto& kvp : varmap.functions) { for (auto& kvp : varmap.functions) {
auto& first = std::get<0>(kvp); auto& first = std::get<0>(kvp);
auto& second = std::get<1>(kvp); auto& second = std::get<1>(kvp);

View File

@ -184,7 +184,7 @@ namespace sol {
void* baseclasscast; void* baseclasscast;
bool mustindex; bool mustindex;
bool secondarymeta; bool secondarymeta;
std::array<bool, 30> properties; std::array<bool, 31> properties;
template <typename N> template <typename N>
void insert(N&& n, object&& o) { void insert(N&& n, object&& o) {
@ -483,7 +483,7 @@ namespace sol {
auto& second = std::get<1>(kvp); auto& second = std::get<1>(kvp);
register_kvp(i, t, first, second); register_kvp(i, t, first, second);
} }
luaL_Reg opregs[32]{}; luaL_Reg opregs[34]{};
int opregsindex = 0; int opregsindex = 0;
auto prop_fx = [&](meta_function mf) { return !properties[static_cast<int>(mf)]; }; auto prop_fx = [&](meta_function mf) { return !properties[static_cast<int>(mf)]; };
usertype_detail::insert_default_registrations<T>(opregs, opregsindex, prop_fx); usertype_detail::insert_default_registrations<T>(opregs, opregsindex, prop_fx);
@ -549,6 +549,7 @@ namespace sol {
luaL_newmetatable(L, &usertype_traits<T>::user_metatable()[0]); luaL_newmetatable(L, &usertype_traits<T>::user_metatable()[0]);
stack_reference t(L, -1); stack_reference t(L, -1);
stack::set_field(L, meta_function::type, type_table, t.stack_index()); stack::set_field(L, meta_function::type, type_table, t.stack_index());
for (auto& kvp : varmap.functions) { for (auto& kvp : varmap.functions) {
auto& first = std::get<0>(kvp); auto& first = std::get<0>(kvp);
auto& second = std::get<1>(kvp); auto& second = std::get<1>(kvp);

View File

@ -394,7 +394,7 @@ namespace sol {
void* baseclasscheck; void* baseclasscheck;
void* baseclasscast; void* baseclasscast;
bool secondarymeta; bool secondarymeta;
std::array<bool, 30> properties; std::array<bool, 31> properties;
template <std::size_t Idx, meta::enable<std::is_same<lua_CFunction, meta::unqualified_tuple_element<Idx + 1, RawTuple>>> = meta::enabler> template <std::size_t Idx, meta::enable<std::is_same<lua_CFunction, meta::unqualified_tuple_element<Idx + 1, RawTuple>>> = meta::enabler>
lua_CFunction make_func() const { lua_CFunction make_func() const {
@ -735,6 +735,7 @@ namespace sol {
// for call constructor purposes and such // for call constructor purposes and such
lua_createtable(L, 0, 3); lua_createtable(L, 0, 3);
stack_reference metabehind(L, -1); stack_reference metabehind(L, -1);
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
if (um.callconstructfunc != nullptr) { if (um.callconstructfunc != nullptr) {
stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index()); stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index());
} }
@ -743,7 +744,6 @@ namespace sol {
stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc)), metabehind.stack_index()); stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc)), metabehind.stack_index());
} }
// type information needs to be present on the behind-tables too // type information needs to be present on the behind-tables too
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
stack::set_field(L, metatable_key, metabehind, t.stack_index()); stack::set_field(L, metatable_key, metabehind, t.stack_index());
metabehind.pop(); metabehind.pop();
@ -763,6 +763,8 @@ namespace sol {
{ {
lua_createtable(L, 0, 3); lua_createtable(L, 0, 3);
stack_reference metabehind(L, -1); stack_reference metabehind(L, -1);
// type information needs to be present on the behind-tables too
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
if (um.callconstructfunc != nullptr) { if (um.callconstructfunc != nullptr) {
stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index()); stack::set_field(L, meta_function::call_function, make_closure(um.callconstructfunc, nullptr, make_light(um), make_light(umc)), metabehind.stack_index());
} }
@ -770,8 +772,6 @@ namespace sol {
stack::set_field(L, meta_function::index, make_closure(umt_t::index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index()); stack::set_field(L, meta_function::index, make_closure(umt_t::index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index());
stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index()); stack::set_field(L, meta_function::new_index, make_closure(umt_t::new_index_call, nullptr, make_light(um), make_light(umc), nullptr, usertype_detail::toplevel_magic), metabehind.stack_index());
stack::set_field(L, metatable_key, metabehind, t.stack_index()); stack::set_field(L, metatable_key, metabehind, t.stack_index());
// type information needs to be present on the behind-tables too
stack::set_field(L, meta_function::type, type_table, metabehind.stack_index());
metabehind.pop(); metabehind.pop();
} }

View File

@ -895,7 +895,7 @@ TEST_CASE("simple_usertype/basic type information", "check that we can query som
sol::state lua; sol::state lua;
lua.open_libraries(sol::lib::base); lua.open_libraries(sol::lib::base);
lua.new_usertype<my_thing>("my_thing"); lua.new_simple_usertype<my_thing>("my_thing");
lua.safe_script("obj = my_thing.new()"); lua.safe_script("obj = my_thing.new()");
@ -919,4 +919,3 @@ TEST_CASE("simple_usertype/basic type information", "check that we can query som
lua.safe_script("assert(not getmetatable(obj).__type.is(\"not a thing\"))"); lua.safe_script("assert(not getmetatable(obj).__type.is(\"not a thing\"))");
lua.safe_script("print(getmetatable(obj).__type.name)"); lua.safe_script("print(getmetatable(obj).__type.name)");
} }

View File

@ -115,7 +115,7 @@ TEST_CASE("object/string-pushers", "test some basic string pushers with in_place
sol::object ocs(lua, sol::in_place, "bark\0bark", 9); sol::object ocs(lua, sol::in_place, "bark\0bark", 9);
sol::object os(lua, sol::in_place_type<std::string>, std::string("bark\0bark", 9), 8); sol::object os(lua, sol::in_place_type<std::string>, std::string("bark\0bark", 9), 8);
sol::object osv(lua, sol::in_place_type<sol::string_view>, std::string_view("woofwoof", 8), 8); sol::object osv(lua, sol::in_place_type<sol::string_view>, sol::string_view("woofwoof", 8), 8);
bool test1 = ocs.as<std::string>() == std::string("bark\0bark", 9); bool test1 = ocs.as<std::string>() == std::string("bark\0bark", 9);
bool test2 = os.as<std::string>() == std::string("bark\0bar", 8); bool test2 = os.as<std::string>() == std::string("bark\0bar", 8);
bool test3 = osv.as<std::string>() == std::string("woofwoof", 8); bool test3 = osv.as<std::string>() == std::string("woofwoof", 8);

View File

@ -1771,7 +1771,7 @@ TEST_CASE("usertype/basic type information", "check that we can query some basic
sol::state lua; sol::state lua;
lua.open_libraries(sol::lib::base); lua.open_libraries(sol::lib::base);
lua.new_simple_usertype<my_thing>("my_thing"); lua.new_usertype<my_thing>("my_thing");
lua.safe_script("obj = my_thing.new()"); lua.safe_script("obj = my_thing.new()");