Skip to content

Instantly share code, notes, and snippets.

@pfirsich
Created October 17, 2018 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfirsich/63a9c38e76681947f32886a6a99a32ef to your computer and use it in GitHub Desktop.
Save pfirsich/63a9c38e76681947f32886a6a99a32ef to your computer and use it in GitHub Desktop.
love.graphics.setColor compatibility monkeypatch for migrating from love 0.10.2 to 11+
do
local oldSetColor = love.graphics.setColor
function love.graphics.setColor(r, g, b, a)
if type(r) == "table" then
assert(#r == 3 or #r == 4)
assert(g == nil and b == nil and a == nil)
r, g, b, a = unpack(r)
end
assert(type(r) == "number" and type(g) == "number" and type(b) == "number")
assert(a == nil or type(a) == "number")
a = a or 255
oldSetColor(r/255, g/255, b/255, a/255)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment