Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Removing Table Data?

Asked by 10 years ago

Is there a other way to remove ALL the data like :ClearAllChildren() maybe? (If thats possible) I mean this is NOT a in-game script function yet... But when it does how could I remove all the data with 1 ROBLOX function?

FakeTable={}
table.insert(FakeTable,{Plr=Pl.Name,Tab=Part})

How would I remove every {Plr,Tab} from 1 table other then table.remove()?

3 answers

Log in to vote
1
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
10 years ago

Well to remove it from the table, you can iterate over it and set each value to nil. However, you can take the easier approach and just create a new table.

Method 1:

-- Iterate through the table
for key, value in next, tbl do
    tbl[key] = nil;
end

Method 2:

-- Just create a new table
tbl = {};
Ad
Log in to vote
0
Answered by
exit16 20
10 years ago

You need to tell use what you are trying to remove and your attempt in your own script so we can debug your error.

Log in to vote
0
Answered by 10 years ago

Remove everything in a table? Easy

Method 1:

Table = {"HI", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, true, false, game.Workspace.Part}
Table = {}

Method 2:

Table = {"HI", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, true, false, game.Workspace.Part}
Table[1] = nil
Table[2] = nil
Table[3] = nil
Table[4] = nil
Table[5] = nil
Table[6] = nil
Table[7] = nil
Table[8] = nil
Table[9] = nil
Table[10] = nil
Table[11] = nil
Table[12] = nil
Table[13] = nil
Table[14] = nil

Method 3:

Table = {"HI", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, true, false, game.Workspace.Part}
for i = 1, #Table do
    Table[i] = nil
end

Answer this question