This would work better, actually...!

This commit is contained in:
ThePhD 2017-03-19 19:16:20 -04:00
parent 6520f1bc8e
commit 4a851699d9

View File

@ -49,7 +49,7 @@ int main(int, char**) {
// Our recursive function // Our recursive function
// We use some lambda techniques and pass the function itself itself so we can recurse, // We use some lambda techniques and pass the function itself itself so we can recurse,
// but a regular function would work too! // but a regular function would work too!
auto fx = [&lua, &things](auto& f, auto tbl) -> void { auto fx = [&lua, &things](auto& f, auto& tbl) -> void {
// You can iterate through a table: it has // You can iterate through a table: it has
// begin() and end() // begin() and end()
// like standard containers // like standard containers
@ -63,8 +63,10 @@ int main(int, char**) {
const sol::object& value = key_value_pair.second; const sol::object& value = key_value_pair.second;
sol::type t = value.get_type(); sol::type t = value.get_type();
switch (t) { switch (t) {
case sol::type::table: case sol::type::table: {
f(f, value.as<sol::table>()); sol::table inner = value.as<sol::table>();
f(f, inner);
}
break; break;
case sol::type::userdata: { case sol::type::userdata: {
// This allows us to check if a userdata is // This allows us to check if a userdata is