1 | function containsColor(img, color) |
2 | local w, g = img.width-1, img.getInt |
3 | for y = 0, img.height-1 do |
4 | for x = 0, w do |
5 | if g(x, y) == color then |
6 | return true |
7 | end |
8 | end |
9 | end |
10 | return false |
11 | end |
test 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: | #485 |
| Snippet name: | containsColor |
| Eternal ID of this version: | #485/1 |
| Text MD5: | 2eccda4b79ac70fecadd0e249fafc5c9 |
| Author: | stefan |
| Category: | image functions |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-03-04 22:40:31 |
| Source code size: | 226 bytes / 11 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 901 / 233 |
| Referenced in: | [show references] |