mirror of
https://github.com/openwrt/packages.git
synced 2025-12-23 21:04:33 +04:00
prometheus-node-exporter-lua: use io.lines(), remove line_split
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
This commit is contained in:
@@ -8,27 +8,16 @@
|
||||
|
||||
socket = require("socket")
|
||||
|
||||
-- Allow us to call unpack under both lua5.1 and lua5.2+
|
||||
local unpack = unpack or table.unpack
|
||||
|
||||
-- Parsing
|
||||
|
||||
function space_split(s)
|
||||
elements = {}
|
||||
local elements = {}
|
||||
for element in s:gmatch("%S+") do
|
||||
table.insert(elements, element)
|
||||
end
|
||||
return elements
|
||||
end
|
||||
|
||||
function line_split(s)
|
||||
elements = {}
|
||||
for element in s:gmatch("[^\n]+") do
|
||||
table.insert(elements, element)
|
||||
end
|
||||
return elements
|
||||
end
|
||||
|
||||
function get_contents(filename)
|
||||
local f = io.open(filename, "rb")
|
||||
local contents = ""
|
||||
|
||||
Reference in New Issue
Block a user