From e49d75a822e37df5ea0ccb6132f58c2cd7ad4d43 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Tue, 6 Jul 2021 09:24:13 +0200 Subject: [PATCH] Fix patterns --- minetest/colorspec.lua | 2 +- persistence.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/minetest/colorspec.lua b/minetest/colorspec.lua index 0536167..3658b12 100644 --- a/minetest/colorspec.lua +++ b/minetest/colorspec.lua @@ -185,7 +185,7 @@ function colorspec.from_string(string) if number then return colorspec.from_number(number * 0x100 + alpha) end - local hex_text = string:match(hex) + local hex_text = string:match("^" .. hex .. "$") local len, num = hex_text:len(), tonumber(hex_text, 16) if len == 8 then return colorspec.from_number(num) diff --git a/persistence.lua b/persistence.lua index a4fb408..1342a7b 100644 --- a/persistence.lua +++ b/persistence.lua @@ -112,7 +112,7 @@ function lua_log_file:_dump(value, is_key) end if _type == "string" then local reference_strings = self.reference_strings - if is_key and ((not reference_strings) or value:len() <= key:len()) and value:match"[%a_][%a%d_]*" then + if is_key and ((not reference_strings) or value:len() <= key:len()) and value:match"^[%a_][%a%d_]*$" then -- Short key return value, true end