mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 16:25:35 +00:00
LuaAPI: Show quotes around strings in table dumps (#60)
This commit is contained in:
parent
b6fa3574fd
commit
f1148ed1c4
@ -96,10 +96,6 @@ void Application::CheckForUpdates() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// thread name stuff
|
// thread name stuff
|
||||||
|
|
||||||
static std::map<std::thread::id, std::string> threadNameMap {};
|
static std::map<std::thread::id, std::string> threadNameMap {};
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define SOL_ALL_SAFETIES_ON 1
|
#define SOL_ALL_SAFETIES_ON 1
|
||||||
#include <sol/sol.hpp>
|
#include <sol/sol.hpp>
|
||||||
|
|
||||||
static std::string LuaToString(const sol::object Value, size_t Indent = 1) {
|
static std::string LuaToString(const sol::object Value, size_t Indent = 1, bool QuoteStrings = false) {
|
||||||
if (Indent > 80) {
|
if (Indent > 80) {
|
||||||
return "[[possible recursion, refusing to keep printing]]";
|
return "[[possible recursion, refusing to keep printing]]";
|
||||||
}
|
}
|
||||||
@ -32,7 +32,11 @@ static std::string LuaToString(const sol::object Value, size_t Indent = 1) {
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
case sol::type::string:
|
case sol::type::string:
|
||||||
|
if (QuoteStrings) {
|
||||||
|
return "\"" + Value.as<std::string>() + "\"";
|
||||||
|
} else {
|
||||||
return Value.as<std::string>();
|
return Value.as<std::string>();
|
||||||
|
}
|
||||||
case sol::type::number: {
|
case sol::type::number: {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << Value.as<float>();
|
ss << Value.as<float>();
|
||||||
@ -53,7 +57,7 @@ static std::string LuaToString(const sol::object Value, size_t Indent = 1) {
|
|||||||
for (size_t i = 0; i < Indent; ++i) {
|
for (size_t i = 0; i < Indent; ++i) {
|
||||||
Result << "\t";
|
Result << "\t";
|
||||||
}
|
}
|
||||||
Result << LuaToString(Entry.first, Indent + 1) << ": " << LuaToString(Entry.second, Indent + 1) << ",";
|
Result << LuaToString(Entry.first, Indent + 1) << ": " << LuaToString(Entry.second, Indent + 1, true) << ",";
|
||||||
}
|
}
|
||||||
Result << "\n";
|
Result << "\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user