How to remove a whole table from a table and put it into another table?

Sorry if the title was confusing but here is an example of what I need to do

         
["Mission"] = {
                   
  {"String","String","String","String", "String", 1}, -- This is the table I want to remove and send to the Completed Missions table

            

      };
["Complete Missions"] = {



 }

Have u tried using table.insert() ?

Ive tried to remove the table like this, but it errors since you cant remove a table from a table only the elements inside

table.remove(table,table)-- table I want to remove

Try doing, local MissonMain = {
{“String”}
}

table.remove(MissionMain[String])

If that doesn’t work try local Remove = table.find(string)

table.remove(Remove)

Remove the index from the “Mission” table using table.remove() and then insert the value using table.insert() into “Complete Missions”

You’re going to have to for loop through the “Missions” table to retrieve the correct index/values.
Unless you properly organized your code, you could just throw in the index.

If you don’t have the quests organized chronologically where each event is at a certain index depending on when it’s activated, you would need to linearly search through the table until you find the quest you want (assuming its name is inside of a table).

Instead you can very simply use dictionaries instead, where each quest is at a key where the key is its name.

["Mission"] = {
                   
  QuestNameHere = {"String","String","String","String", "String", 1}, 

};

And when you want to transfer that table from Mission to Complete Missions

t["Complete Missions"][the quest name] = t["Missions"]
t["Missions"][the quest name] = nil

Also you can just make “Complete missions” hold an array of strings, where those strings are names of completed missions (this is if you don’t need the info inside of the quest after it being completed)

tableinsert(t["Complete Missions"], the quest name)
t["Missions"][the quest name] = nil
1 Like

Alright so basically this is the way I structure the quest information, I decided to make it into a dictionary like you said, I just need to update how I put it into my Uncompleted Missions folder


1 Like

Hey, I tried your method and like I havent completely set it up yet, but its working and the index is the quest name thank you!!!

image
index ^ , values ^

1 Like