gluon-core: util: avoid unintended second return value from gsub()

gsub() returns the number of matches as its second return value. This
was unintendedly passed through by the util functions trim() and
node_id(). It can be presumed that this had no effect in practice, but
it can lead to surprising output when passing values to print() for
debugging.
This commit is contained in:
Matthias Schiffer 2020-05-04 23:38:22 +02:00
parent daf8a6c18c
commit 0e681d5c37
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -23,7 +23,7 @@ local function do_filter_prefix(input, output, prefix)
end
function M.trim(str)
return str:gsub("^%s*(.-)%s*$", "%1")
return (str:gsub("^%s*(.-)%s*$", "%1"))
end
function M.contains(table, value)
@ -96,7 +96,7 @@ function M.exec(command)
end
function M.node_id()
return string.gsub(sysconfig.primary_mac, ':', '')
return (string.gsub(sysconfig.primary_mac, ':', ''))
end
function M.default_hostname()