Log In  
Follow
evn

According to the PICO-8 0.2.2c manual, "To remove an item at a particular index, use deli"

del t v

Delete the first instance of value v in table t
The remaining entries are shifted left one index to avoid holes.
Note that v is the value of the item to be deleted, not the index into the table.
(To remove an item at a particular index, use deli instead)
del returns the deleted item, or returns no value when nothing was deleted.

A={1,10,2,11,3,12}
FOR ITEM IN ALL(A) DO
IF (ITEM < 10) THEN DEL(A, ITEM) END
END
FOREACH(A, PRINT) -- 10,11,12
PRINT(A[3]) -- 12

deli t [i]

Like del(), but remove the item from table t at index i.
When i is not given, the last element of the table is removed and returned.


However, this does not seem to work with string or float indices. (Only tested on macOS Mojave)
The desired result can be achieved using

[ Continue Reading.. ]

1
3 comments