From 211a2bfcf541b7821bd06fc97ba6e3c9ee8b6d94 Mon Sep 17 00:00:00 2001 From: crondog Date: Fri, 24 Jul 2015 15:08:18 +0200 Subject: [PATCH] contrib: make pulse compatible with lua5.3 String.format does like converting float to hex (or int for that matter). This fixes the issue Signed-off-by: Adrian C. (anrxc) --- contrib/pulse.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/pulse.lua b/contrib/pulse.lua index b06bf56..663a6ab 100644 --- a/contrib/pulse.lua +++ b/contrib/pulse.lua @@ -18,7 +18,8 @@ local string = { gmatch = string.gmatch } local math = { - floor = math.floor + floor = math.floor, + ceil = math.ceil } -- }}} @@ -99,6 +100,8 @@ function pulse.add(percent, sink) if vol > 0x10000 then vol = 0x10000 end if vol < 0 then vol = 0 end + vol = math.ceil(vol) + local cmd = string.format("pacmd set-sink-volume %s 0x%x >/dev/null", sink, vol) return os.execute(cmd) end