From bab8c2b629453b00b3d712ccb161abca839a9393 Mon Sep 17 00:00:00 2001 From: tour Date: Sat, 14 Sep 2024 20:43:04 +0200 Subject: [PATCH] little speedup (hopefully) --- algtour.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/algtour.lua b/algtour.lua index 2c8e4ee..0f63ec4 100644 --- a/algtour.lua +++ b/algtour.lua @@ -84,7 +84,7 @@ end local function parse_flat_table(str) if str:find("{%s*}") then return true, {} end - str = str:gsub("^{(.-)[,;]?%s*}$", "%1,") + str = str:match("^{(.-)[,;]?%s*}$") .. "," local next_index = 1 local res = {} @@ -92,7 +92,7 @@ local function parse_flat_table(str) local key, value, success if pair:find("=") then key, value = pair:match("^(.-)=(.*)$") - key = key:gsub("^%s*(.-)%s*$", "%1") + key = key:match("^%s*(.-)%s*$") success, key = parse_key(key) if not success then return false, key end else @@ -103,7 +103,7 @@ local function parse_flat_table(str) next_index = next_index + 1 value = pair end - value = value:gsub("^%s*(.-)%s*$", "%1") + value = value:match("^%s*(.-)%s*$") success, value = parse_value(value) if not success then return false, value end