KOPTInterface: Minor optimization when hashing the configurable status

Use a table & table.concat instead of individual concats.
And then use that same table for every hash-related operation.

(Nothing else uses the configurable hash function, otherwise I'd have
limited the table shenanigans to the function itself).
This commit is contained in:
NiLuJe
2021-05-09 19:08:03 +02:00
parent 48c474e245
commit 1ffbd8760d
3 changed files with 67 additions and 47 deletions

View File

@@ -18,15 +18,13 @@ function Configurable:reset()
end
end
function Configurable:hash(sep)
local hash = ""
function Configurable:hash(list)
for key, value in ffiUtil.orderedPairs(self) do
local value_type = type(value)
if value_type == "number" or value_type == "string" then
hash = hash..sep..value
table.insert(list, value)
end
end
return hash
end
function Configurable:loadDefaults(config_options)