Better lui print

This commit is contained in:
fed 2022-09-26 21:34:26 +02:00
parent 29182cd604
commit 2d575519b7

View File

@ -357,7 +357,26 @@ namespace ui_scripting
setup_functions(); setup_functions();
lua["print"] = function(reinterpret_cast<game::hks::lua_function>(0x1402B81C0)); lua["print"] = [](const variadic_args& va)
{
std::string buffer{};
const auto to_string = get_globals()["tostring"];
for (auto i = 0; i < va.size(); i++)
{
const auto& arg = va[i];
const auto str = to_string(arg)[0].as<std::string>();
buffer.append(str);
if (i < va.size() - 1)
{
buffer.append("\t");
}
}
console::info("%s\n", buffer.data());
};
lua["table"]["unpack"] = lua["unpack"]; lua["table"]["unpack"] = lua["unpack"];
lua["luiglobals"] = lua; lua["luiglobals"] = lua;