Important Note: You need a terminal that supports unicode if you are planning on outputting to terminal, or you can just write to file.
Do you know 2-dimensional arrays in lua? The first index is x, second index is y. For example,
local t = {}
t[1][2] = 1This sets the dot x = 1, y = 2 {1, 2} as 1.
To use this library, just require it and call it as so.
local Pixel = require('Pixel')
local t = {
[1] = {
[1] = 1,
[2] = 0,
[3] = 1
}
}
local out = Pixel(t)
print(out)The code has been carefully optimized, so there might be "dirty" / hard-coded parts.
TODO
Steps
- Convert to rows locally
- Finds the min / max of x and y
- Iterate over rows (y)
- Iterate over column (x)
- Look at each 2x4 "pixel"
- Push to out
- Repeat
- Return