As the title says.
I’m trying to make a variable collection thing using attributes, it works by putting attributes that are available into a table and then it’s unpacked for other parts of my script to use:
local VariableTable = {}
local CurrentVariableNumber = 1
local VariableToAdd = CacheFolder:GetAttribute("Variable"..CurrentVariableNumber)
if VariableToAdd then
table.insert(VariableTable, CurrentVariableNumber, VariableToAdd)
CurrentVariableNumber = CurrentVariableNumber+1
end
return VariableTable
the problem with attributes is that they don’t store nil values in themselves, so if I needed a nil value to be returned it won’t be returned because you can’t put nil values in tables either, which is a problem because I use table.unpack after getting the table result.
My idea right now is to make attributes that need to have nil values have a string nil and have it become nil if detected in a dictionary, my issue right now is trying to loop through tuples, how do you iterate through a tuple from a table.unpack?
Edit: Current Scenario I’m trying to solve
I have seven variables made that each fire SetAttribute()
Variables 1-4 are random numbers.
Variables 5-6 are nil. They are needed readable nil values.
Variable 7 is a random number. This is a needed value.
Variables 5-7 aren’t being returned from table.unpack from my variable collection, they are being indexed correctly with Table[5] = nil, Table[6] = nil, Table[7] = 25 but only Table[1-4] gets readable printed back and nothing appears after 5-7.