Skip to content

Instantly share code, notes, and snippets.

@marceloCodget
marceloCodget / gist:3862929
Created October 10, 2012 03:05
RGB to Hex in Lua
-- passing a table like {255, 100, 20}
function application:rgbToHex(rgb)
local hexadecimal = '0X'
for key, value in pairs(rgb) do
local hex = ''
while(value > 0)do
local index = math.fmod(value, 16) + 1