lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>From lua-l@tecgraf.puc-rio.br Wed Jul  7 20:35:02 1999
>From: Ken Rawlings <krawling@shooter.bluemarble.net>

>   I have a quick question on Lua datatypes. What is the preferred method
>   for generating and using lists in Lua? Originally I thought that the
>   following could be used:
>
>   l = { 1, 2, 4, 5 }
>
>   However, it appears that Lua doesn't have a method for adding or 
>   deleting data at an arbitrary position. For instance, how can you
>   add '3' to the table above between '1' and '2'? Along the same lines,
>   how can you delete the '4'? I've read through the manual to no
>   avail. Am I missing something?

Lua 3.2 (to be released in a couple of days) has a new built-in function
tinsert that does this. (You can try it now with 3.2 beta.)
--lhf