Small Table Bug/Error? - https://streamable.com/8uctgn

Shaking in fear

  1. What do you want to achieve? Keep it simple and clear!
    A working table

  2. What is the issue? Include screenshots / videos if possible!
    A table is not keeping its contents (I even made a new one in the Video Below:)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Creating a new table
-- Le Video is needed to see what's wrong(has console to see stuff)

Cards = {"A","B","B","C","A","B","A","B","B","C","A","B"} --12
		DeckMiss = {"A","A","C","A","A","A","B"} --7
--(above is just for testing)
		--[[
		local Inventory = (GetDeckData(player, "Bestiary"))
		local Deck = ClearTable(Inventory["Decks"][TickListNum]["Cards"])
		Inventory = Inventory["Cards"]
		]] --will use after testing
		local Inventory = Cards
		local Deck = DeckMiss
		local DontChange = Cards --Problem (Watch Vid) >>>
		print(DontChange) --Problem (Watch Vid) >>>
		
		local Test = Tick(Inventory, Deck, true) Test = ClearTable(Test)
		
		print("Brand New Deck:")
		print(DontChange) --Problem (Watch Vid) >>>
		local Test2 = Tick(Inventory, Test, false) Test2 = ClearTable(Test2)
		print(Test2)

DontChange and Cards both refer to the same table, so any change to Cards will also affect DontChange.

Use DontChange = table.clone(Cards) so DontChange will refer to its own, separate table

1 Like

ohh, I didnt know that. I thought creating a variable would just automatically make a different table, thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.