test.lua

Wed, 27 Oct 2010 14:12:51 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 27 Oct 2010 14:12:51 +0100
changeset 5
fa4d448b07d3
parent 1
8724d7c9318e
permissions
-rw-r--r--

test_mandelbrot.lua: Remove some trailing whitespace

1
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local xpm = require "xpm"
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 image = xpm.new(100, 100);
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 for i=1,100 do
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 local colour = "#"..tostring(i, 16):rep(3);
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 for x=i,image.width-i+1 do
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 image:setpixel(x, i, colour);
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 image:setpixel(x, image.height-i+1, colour);
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 end
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 for y=i,image.height-i+1 do
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 image:setpixel(i, y, colour);
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 image:setpixel(image.width-i+1, y, colour);
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 end
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 end
8724d7c9318e Add test
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 image:render(io.stdout);

mercurial