PICO-8 Wiki
(Adding categories)
(helps to pay attention to the actual goal)
Tag: Source edit
(2 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
* [[Tables]]
 
* [[Tables]]
 
* <code>[[Add|add()]]</code>
 
* <code>[[Add|add()]]</code>
* <code>[[Deli|del()]]</code>
+
* <code>[[Del|del()]]</code>
 
* <code>[[All|all()]]</code>
 
* <code>[[All|all()]]</code>
 
* <code>[[Foreach|foreach()]]</code>
 
* <code>[[Foreach|foreach()]]</code>
Line 25: Line 25:
 
[[Category:Reference]]
 
[[Category:Reference]]
 
[[Category:API]]
 
[[Category:API]]
[[Category:Api]]
 

Revision as of 20:37, 11 March 2021

deli( tbl, i )
Removes the element at the given index of a sequence in a table.
tbl
The table.

i
The index for the value to be removed.

The deli() function removes the value at the given index of a sequence. All subsequent values in the sequence shift down by one slot to keep the sequence contiguous.

The deli() function returns the object being removed. This can be ignored, tested it to see if the removal was successful, or used as needed.

Example

t = {1, 2, 4, 3, 4}
deli(t, 5)  -- t = {1, 2, 4, 3}
deli(t, 3)  -- t = {1, 2, 3}

See also