Fix compile issue with asio, implement Lua events

This commit is contained in:
Lion Kortlepel
2021-09-16 13:03:00 +02:00
parent ebe3630ec8
commit 26231c6272
5 changed files with 73 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
#include "LuaAPI.h"
#include "TLuaEngine.h"
static std::string LuaToString(const sol::object& Value) {
static std::string LuaToString(const sol::object& Value, size_t Indent = 1) {
switch (Value.get_type()) {
case sol::type::string:
return Value.as<std::string>();
@@ -15,10 +15,17 @@ static std::string LuaToString(const sol::object& Value) {
Result << "[[table: " << Table.pointer() << "]]: {";
if (!Table.empty()) {
for (const auto& Entry : Table) {
Result << "\n\t" << LuaToString(Entry.first) << ": " << LuaToString(Entry.second) << ",";
Result << "\n";
for (size_t i = 0; i < Indent; ++i) {
Result << "\t";
}
Result << LuaToString(Entry.first, Indent + 1) << ": " << LuaToString(Entry.second, Indent + 1) << ",";
}
Result << "\n";
}
for (size_t i = 0; i < Indent - 1; ++i) {
Result << "\t";
}
Result << "}";
return Result.str();
}