Clear table

Hello,

i have a question about tables and arrays: what the most effective way to clear everything( i.e reset) from table or array? Can anyone show me an example, please?

any help is appreciated

If you want to clear everything from the table? Use:

t = {}

thanks, although i already have understanding of tables and know how to clear them, but wanted to ask opinions)

I use a for loop to iterate through the table. This only works for tables with a numeric key.

1
2
3
4
5
6
local table = {}
 
for i=1, #table do
    table[i]:removeSelf() -- Optional Display Object Removal
    table[i] = nil        -- Nil Out Table Instance
end
views:1357 update:2011/11/17 9:28:17
corona forums © 2003-2011