Log In  
:: Unfold ::

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.

            IF (ITEM < 10) THEN DEL(A, ITEM) 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

t[i] = nil

which seems to be the accepted way in lua.
Possible resolutions:

  • Update deli(t,i) to work with all index types
  • Update PICO-8 manual to specify deli only works with integer indices, and include t[i]=nil workaround.

thank you :)

P#89289 2021-03-21 03:16

Follow Lexaloffle:          
Generated 2022-11-29 17:30:48 | 0.061s | Q:6