Hi there... am I totally stuck on an error I have with my code and I can not for the life of me work out how to fix it. I have tried rebuilding the entire tool 4 times.. each with a different method and nothing works.. I think I have tracked down the problem.. but as far as I know.. it shouldn't be a problem so I have no idea how to fix it.
The Situation
- I have a bag of 27 card, each named.
- I loop through the bag, and add to a table data form the cards found inside the bag. The GUID goes in as the key and the NAME goes in as the value
The Problem
This makes a a table of 26....
Code:
for k, v in ipairs(getBag('player').getObjects()) do
bag_Deck[v.guid] = '???'
end

The resulting table is ALWAYS 26 instead of 27 in length.
Code:
local bag_Deck = {}
for k, v in ipairs(getBag('player').getObjects()) do
table.insert(bag_Deck, v.guid)
end

The resulting table is ALWAYS 27 in length.
I am getting length by....
Code:
function varLength(v)
local count = 0
for k, v in pairs(v) do
count = count + 1
end
return count
end
print(varLength(bag_Deck))
The bag itself has 27 items in it.