We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was trying to dump all the User defined functions, variables and types. This following program get struck in endless loop.
#include <fmt/format.h> #include <sol/sol.hpp> template<typename T> void helper(const T &table, int indent) { if constexpr (std::is_same_v<T, sol::table>) { if (!table.valid()) { return; } } for (auto &element : table) { const sol::object &key = element.first; const sol::object &value = element.second; std::string k = key.as<std::string>(); sol::type v_t = value.get_type(); sol::type k_t = value.get_type(); std::string filler; filler.resize(indent, ' '); switch (v_t) { case sol::type::string: std::cout << fmt::format("{}{} : {}", filler, k, value.as<std::string>()); break; case sol::type::number: std::cout << fmt::format("{}{} : {}", filler, k, value.as<double>()); break; case sol::type::userdata: { { std::cout << fmt::format("User Data: {}{}", filler, k); } } break; case sol::type::table: { std::cout << fmt::format("Table Data: {}{}", filler, k); const sol::optional<sol::table> &t2 = table[k]; if (t2) { helper(t2.value(), indent + 3); } } break; default: // std::cout << fmt::format("{}{} : Unknown Type", filler, k); break; } } } dump_state(const sol::state &state) { helper<sol::state>(state, 0); }
How can I identify
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I was trying to dump all the User defined functions, variables and types. This following program get struck in endless loop.
How can I identify
The text was updated successfully, but these errors were encountered: