RGB do Hex Lua

-- assumes decimal values of r, g and b but can be easily retrofitted
function rgb_to_hex(r, g, b)
    --%02x: 0 means replace " "s with "0"s, 2 is width, x means hex
	return string.format("#%02x%02x%02x", 
		math.floor(r*255),
		math.floor(g*255),
		math.floor(b*255))
end

rgb_to_hex(0.01, 0.3, 0.1)
-- returns #024c19
dog dog dog dog dog