From dfb4a035c2d80a6be689e14ca495b8ba032f58c4 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Thu, 30 Oct 2025 10:02:27 +0100 Subject: Test full userdata keys with verbose_errors --- src/intercopycontext.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index 0ccd619..4be1883 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp @@ -494,8 +494,12 @@ void InterCopyContext::interCopyKeyValuePair() const *std::format_to(_valPath, "{}[U:{}]", name, _key) = 0; } else if (luaW_type(L1, _key_i) == LuaType::BOOLEAN) { int const _key{ lua_toboolean(L1, _key_i) }; - _valPath = static_cast(alloca(name.size() + 8)); // +8 for [], 'false' and terminating 0 + _valPath = static_cast(alloca(name.size() + 8)); // +8 for [false] and terminating 0 *std::format_to(_valPath, "{}[{}]", name, _key ? "true" : "false") = 0; + } else if (luaW_type(L1, _key_i) == LuaType::USERDATA) { + // I don't want to invoke tostring on the userdata to get its name + _valPath = static_cast(alloca(name.size() + 11)); // +11 for [U:] and terminating 0 + *std::format_to(_valPath, "{}[U:]", name) = 0; } } -- cgit v1.2.3-55-g6feb