|Attention||Topic was automatically imported from the old Question2Answer platform.|
-using Godot 3.02
Anyone know a method to update an array with only new values? In other words, checking a array with another array maybe?
I am creating a list inventory, where each button is a item, and I would like to update this list of buttons with only new items from the inventory.
I am trying to do this with a custom update function, but how do I check a array to see if anything changed?
Though about deleting the list of buttons and create them from scratch everytime my update function is called, but that is not optmized. Maybe my though process is wrong?
Thank you for your assistance,
do you mean you want to insert to array only not existing items? e.g. [a,b,c] + [a,c,d] → [a,b,c,d]
Bartosz | 2018-03-21 16:37
Ahm, yea, never though it would be that simple… Thanks man, that helps a lot.
But how do I compare two arrays for their values?
Edit: Found out, woa it is really simple to use arrays and dictionaries.
var a1 = [0,1,0]
var a2 = [0,1,0]
print(a1 == a2) #Returns true
The_Black_Chess_King | 2018-03-21 20:11