Im having a bit of trouble understanding how to use tables, I'm quite new to programming so I took some code from Dylan Bennett who made some excellent tutorials on pico-8.
I'm using a table to create bills on screen and then delete them one by one from the screen.
So far so good.
But now I want to make a cursor that blinks on the last bill in the table, then after deletion, the cursor would hover on the next last bill in the table.
To make that work I would need the X and Y coordinates of the last placed bill and the ones following after that.
That's where I get into trouble. I'm using this function to set up the bills coordinates and sprite;
function make_bill(x,y) b={} b.x=x b.y=y b.sprite=rnd(3)+3 add(bills,b) end |
Then I use this to create the bills;
function make_bills() bills={} for i=1,100,1 do make_bill(32+rnd(56),32+rnd(56)) end end |
But when I use a debug to find the b.x and b.y values it returns a fixed number that doesn't change as I delete the bills. Also checking in debug shows that the table b = 0.



