Hi everyone, this is a follow up from my last question about fitting cards into a Frame.
I am using the global table (_G) to keep a record of all the player's cards. I have set up my player's card table like so:
_G.PlayerCards = { ["Wild"] = {}; ["Red"] = {}; ["Blue"] = {}; ["Green"] = {}; ["Yellow"] = {}; }
I have another table in another script that contains information on all the cards in the game:
_G.Cards = { ["Wild"] = { ["Normal"] = {"",0,0,"Normal","Wild"}; ["Draw Four"] = {"",0,0,"Draw Four","Wild"}; }; ["Red"] = { ["0"] = {}; ["1"] = {}; ["2"] = {}; ["3"] = {}; ["4"] = {}; ["5"] = {}; ["6"] = {}; ["7"] = {}; ["8"] = {}; ["9"] = {}; ["Skip"] = {}; ["Reverse"] = {}; ["Draw Two"] = {}; }; ["Blue"] = { ["0"] = {}; ["1"] = {}; ["2"] = {}; ["3"] = {}; ["4"] = {}; ["5"] = {}; ["6"] = {}; ["7"] = {}; ["8"] = {}; ["9"] = {}; ["Skip"] = {}; ["Reverse"] = {}; ["Draw Two"] = {}; }; ["Green"] = { ["0"] = {}; ["1"] = {}; ["2"] = {}; ["3"] = {}; ["4"] = {}; ["5"] = {}; ["6"] = {}; ["7"] = {}; ["8"] = {}; ["9"] = {}; ["Skip"] = {}; ["Reverse"] = {}; ["Draw Two"] = {}; }; ["Yellow"] = { ["0"] = {}; ["1"] = {}; ["2"] = {}; ["3"] = {}; ["4"] = {}; ["5"] = {}; ["6"] = {}; ["7"] = {}; ["8"] = {}; ["9"] = {}; ["Skip"] = {}; ["Reverse"] = {}; ["Draw Two"] = {}; }; }
Now, I want to be able to use these tables together and use the player's cards table to copy a base ImageLabel (card) from inside the script and set it's values accordingly using the values in the table.
Firstly, I would like to ask if the way I'm going about this is efficient. Is there any easier way of doing this, and if so, how would I go about incorporating it?
Secondly, how could I avoid the script making duplicate cards? I was looking to put in a unique identifier for each card and compare it to the cards already in the players but I don't know where I'd put the unique identifier.
Any help is appreciated, thanks.