dio: import string.match()

This commit is contained in:
Adrian C. (anrxc) 2011-03-29 16:41:24 +02:00
parent c2f7fbcf23
commit 729ceb7865
1 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@
local pairs = pairs local pairs = pairs
local io = { lines = io.lines } local io = { lines = io.lines }
local setmetatable = setmetatable local setmetatable = setmetatable
local string = { match = string.match }
local helpers = require("vicious.helpers") local helpers = require("vicious.helpers")
local os = { local os = {
time = os.time, time = os.time,
@ -32,8 +33,8 @@ local function worker(format)
for line in io.lines("/proc/diskstats") do for line in io.lines("/proc/diskstats") do
local device, read, write = local device, read, write =
-- Linux kernel docs: Documentation/iostats.txt -- Linux kernel documentation: Documentation/iostats.txt
line:match("([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+)") string.match(line, "([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+)")
disk_lines[device] = { read, write } disk_lines[device] = { read, write }
end end