end)
end
+function clamp(x, min, max)
+ return math.min(math.max(x, min), max)
+end
+
+function mpc:change_volume(change)
+ self:send("status", function(_, status)
+ new_vol = clamp(tonumber(status.volume) + change, 0, 100)
+ self:send("setvol " .. new_vol)
+ end)
+end
+
+function mpc:currentsong()
+ local currentsong
+ self:send("currentsong", function(err, song)
+ if err then error(err) end
+ currentsong = song
+ end)
+ return currentsong
+end
+
--[[
-- Example on how to use this (standalone)