function rgb(i)
local r = bit32.band(bit32.rshift(i, 16), 255)
local g = bit32.band(bit32.rshift(i, 8), 255)
local b = bit32.band(i, 255)
return r, g, b
end
function bright(r, g, b)
return (r+g+b)/(255*3)
endtest run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #348 |
| Snippet name: | rgb functions |
| Eternal ID of this version: | #348/1 |
| Text MD5: | f271f57d9b63385de6c588273f73b0ed |
| Author: | stefan |
| Category: | |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-01-26 00:24:41 |
| Source code size: | 232 bytes / 10 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1123 / 555 |
| Referenced in: | [show references] |