From f3b8b77d20ebe3171d3eda306e36e780e04d9ca0 Mon Sep 17 00:00:00 2001 From: gilzoide Date: Sat, 14 Oct 2023 13:43:18 -0300 Subject: [PATCH] Update `variant__call` error message to include Variant type found --- src/luaopen/variant.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/luaopen/variant.cpp b/src/luaopen/variant.cpp index 9128c79..7c1f4b1 100644 --- a/src/luaopen/variant.cpp +++ b/src/luaopen/variant.cpp @@ -161,7 +161,11 @@ bool variant_is(const Variant& variant, const sol::stack_object& type) { } sol::stack_object variant__call(sol::this_state L, const Variant& variant, sol::variadic_args args) { - ERR_FAIL_COND_V_MSG(variant.get_type() != Variant::CALLABLE, to_lua(L, Variant()), "Variant must be a Callable to be called."); + ERR_FAIL_COND_V_MSG( + variant.get_type() != Variant::CALLABLE, + to_lua(L, Variant()), + String("attempt to call a %s value") % get_type_name(variant) + ); VariantArguments var_args = args; Callable callable = variant; Variant result = callable.callv(var_args.get_array());