What is the problem?
edited 1×, last 02.01.19 04:08:23 pm
function Color(r,g,b) 	if not r then r = 0 end 	if not g then g = 0 end 	if not b then b = 0 end 	local r,g,b = tostring(r),tostring(g),tostring(b) 	while string.len(r) < 3 do r = "0"..r end 	while string.len(g) < 3 do g = "0"..g end 	while string.len(b) < 3 do b = "0"..b end 	if string.len(r) == 3 and string.len(g) == 3 and string.len(b) == 3 then 		return "\169"..r..g..b 	end 	return "\169255255255" end
print(Color(1,2,3))line for testing, even
print(Color())works without error)
if string.len(r) == 3 and string.len(g) == 3 and string.len(b) == 3 then return "\169"..r..g..b end return "\169255255255"
local r,g,b = tostring(r),tostring(g),tostring(b)
while string.len(r) < 3 do r = "0"..r end while string.len(g) < 3 do g = "0"..g end while string.len(b) < 3 do b = "0"..b end if string.len(r) == 3 and string.len(g) == 3 and string.len(b) == 3 then return "\169"..r..g..b end
function Color(r, g, b) 	return string.format("\169%0.3u%0.3u%0.3u", r or 0, g or 0, b or 0) end