Insert a table element

Added by iNTERFACEWARE

Use table.insert() to insert an element into a table

Source Code
   -- insert at the end of the table = default
   t = {[1]='one',[2]='two'}
   table.insert(t,'three')
   trace(t[3]) --> "three"
   trace(t)    --> {[1]='one',[2]='two',[3]='three'}
   
   -- insert in the middle of the table
   t = {[1]='one',[2]='three'}
   table.insert(t,2,'two')
   trace(t[2]) --> "two"   
   trace(t)    --> {[1]='one',[2]='two',[3]='three'}
Description
Use table.insert() to insert an element into a table