From 99650fb573b2ed196bd8673fe83197d779585d25 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Mon, 10 Jun 2019 19:41:19 +0200 Subject: [PATCH] Made errors slightly more tolerant. --- string_distance.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/string_distance.lua b/string_distance.lua index 7845bf3..629fa64 100644 --- a/string_distance.lua +++ b/string_distance.lua @@ -177,7 +177,8 @@ local function strings_with_highest_similarity (str, list_of_other_str) if type(str) ~= 'string' then error(('[errors/internal]: Bad argument #1, expected string, got %s (%s)'):format(str, type(str))) end if type(list_of_other_str) ~= 'table' then error(('[errors/internal]: Bad argument #2, expected table, got %s (%s)'):format(list_of_other_str, type(list_of_other_str))) end for i = 1, #list_of_other_str do - if type(list_of_other_str[i]) ~= 'string' then error(('[errors/internal]: Bad argument #2, expected sequence of strings, but got %s (%s) on index %i'):format(list_of_other_str[i], type(list_of_other_str[i]), i)) end + list_of_other_str[i] = tostring(list_of_other_str[i]) + --if type(list_of_other_str[i]) ~= 'string' then error(('[errors/internal]: Bad argument #2, expected sequence of strings, but got %s (%s) on index %i in sequence'):format(list_of_other_str[i], type(list_of_other_str[i]), i)) end end -- Do work