mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 01:03:46 +01:00
Fix colorspec:to_string()
This commit is contained in:
parent
2d47f5fd9f
commit
9a70d4cc98
@ -290,10 +290,11 @@ end
|
|||||||
--> hex string, omits alpha if possible (if opaque)
|
--> hex string, omits alpha if possible (if opaque)
|
||||||
function colorspec:to_string()
|
function colorspec:to_string()
|
||||||
if self.a == 255 then
|
if self.a == 255 then
|
||||||
return ("%02X%02X%02X"):format(self.r, self.g, self.b)
|
return ("#%02X%02X%02X"):format(self.r, self.g, self.b)
|
||||||
end
|
end
|
||||||
return ("%02X%02X%02X%02X"):format(self.r, self.g, self.b, self.a)
|
return ("#%02X%02X%02X%02X"):format(self.r, self.g, self.b, self.a)
|
||||||
end
|
end
|
||||||
|
metatable.__tostring = colorspec.to_string
|
||||||
|
|
||||||
--! This is not a Minetest-accepted number, use :to_number_argb() instead
|
--! This is not a Minetest-accepted number, use :to_number_argb() instead
|
||||||
function colorspec:to_number()
|
function colorspec:to_number()
|
||||||
|
Loading…
Reference in New Issue
Block a user