Delete / Clear Table

I’m sure this is really simple, but how do I clear out a table to start a new game? I’m storing player selections in a table

table = {}  
table.character = "Bob"  
table.money = 5000  
table.turn = 12  

So how to I clear all this out so when the game returns to the menu money and the turn count are reset?

table = nil  

Setting the table to nil doesn’t work and I’ve tried using a for pairs loops to cycle through the keys and set them equal to nil

for k,v in pairs( table ) do k=nil end  

Again, I’m sorry for such a simple question but this is really bugging me! [import]uid: 45104 topic_id: 13359 reply_id: 313359[/import]

try this
[lua]local t = {}
t.one = “one”
t.two = “two”

for i,v in pairs(t) do
print(v)
end

for i,v in pairs(t) do
v = nil
print(v)
end[/lua] [import]uid: 16142 topic_id: 13359 reply_id: 49014[/import]

i don’t understand the problem. setting table to nil should clear the table and all of its values. [import]uid: 46529 topic_id: 13359 reply_id: 49018[/import]

@culutas Yeah I don’t know why that’s not working. I tried @darkconsoles method as well,

print( "start new game" )  
  
table = nil  
for i,v in pairs(table) do  
v = nil  
print(i,v)  
end  
table = {}  
print( table )  

which seems to work but then I get this in the terminal print out:

  
Output string :: start new game  
  
Output string :: character  
  
Output string :: gender  
  
Output string :: turn  
  
Output Table Data:  
 Key: cand Value: Bob  
 Key: gender Value: Mr.   
 Key: turn Value: 10  

The for loop looks like it’s clearing the values, but then the table output prints out like nothing happened!

Note that I am using Crawl Space Lib and Director, so that’s why my output is a little different.

Thanks for your help. I’m getting ready to start a small sandbox project to try to isolate the issue. I’m sure it’s something stupid I’m overlooking. [import]uid: 45104 topic_id: 13359 reply_id: 49032[/import]