|
| 06 Nov 2011 12:42 PM |
How would I use table.remove to find something in a table and remove it. I don't know how to find the position of what I want. like say I want to remove "s" but I don't know what position in the table it is.
table = { "s", "a", b"}
table.remove(table, lolwhathere) --How can I find the position
--I know where "s" was, act as if I didn't know, how could I find it?
|
|
|
| Report Abuse |
|
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 06 Nov 2011 12:46 PM |
table = { "s", "a", "b"}
function FindFirstTableObj(tableName,object) for index,child in ipairs(tableName) do if child==object then print(index) return true end end end
FindFirstTableObj(table,"s")
Do something like that |
|
|
| Report Abuse |
|
|