Trying to use a loop to create graphical elements and what I gather is I need more context then just g:
since it was be the loop's self in this case and not the functions? but I can not quite figure out what that context would be. Tried everything I can think of and did a fair amount of searching for an answer but I do not quite get lua's implementation of OOP and not completely sure I have it's scope and inheritance down, mostly I am just confusing myself at this point and blindly trying any solution I can think of. Simple example of what I am trying to do:
function boxes.paint(g)
for i = 1, 8 do
for j = 1, 8 do
g:set_color(table.unpack(self.bg[i][j]))
g:fill_rect(i*25, j*25, 25, 25)
end
end
end
Edit: Related question, is it possible to have each of those rectangles end up in their own layer?