I had several different card deck tables:
abilitycards
blesingcards
recoursecards
These tables contained a list of cards and wether they were in use or not, as example:
Code: Select all
abilitycards = {
["farmer"] = {inuse=TRUE}
}
Hence at beginning of game, it would go through all the cards and check if they have "inuse" set to TRUE or not, and if TRUE, then add it to the actual playing deck.
What I wanted to do was something like this:
Code: Select all
function FormDeck(deckname)
foreach(deckname, checktoaddcard)
endfunction
function checktoaddcard(card, data)
if data.inuse=true then insertItem(???deckname???, card)
endfunction
FormDeck("abilitycards")
FormDeck("blessingcards")
FormDeck("resourcecards")
And yes, I know just putting the name that was given when entering the function is not enough yet, since it will be replacing the original deck with new one making original one destroyed, but I used this wrong version to explain the main problem, for as long as i could first somehow pass the "deckname" through, its not hard to get it form its own deck of cards with different name.