Jump to content

Format/delete a table..


Feche1320

Recommended Posts

Posted

For example, I have this:

  
local table = { value1 = {}, value2 = {}, value3 = {} } 
  
for i = 1, math.random(9999, 99999) do 
    table.insert(table, { value1 = math.random(1, 10), value2 = math.random(500, 1000), value3 = "wawawa" ..i }) 
end 

Now, how could I clear the table, leaving it empty again?

Thanks!

PD: That is an example.

Posted
local table = { value1 = {}, value2 = {}, value3 = {} } 
  
for i = 1, math.random(9999, 99999) do 
    table.insert(table, { value1 = math.random(1, 10), value2 = math.random(500, 1000), value3 = "wawawa" ..i }) 
end 
  
-- makes the table to an empty table 
table = {} 

Posted

You can this:

  
tTable =  
{  
    value1 = { }; 
    value2 = { }; 
    value3 = { }; 
} 

Or this

  
tTable = { } 
tTable.value1 = { } 
tTable.value2 = { } 
tTable.value3 = { } 
  

It same.

You mean it?

Or i not understand ..

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...