I need to get a chunk in an array that does not start at 1, but when doing so, it throws up a nil even though the index is not nil.
I don’t know what this is called but getting the array values with pairs() works, I need to get a specific value here though.
I tried using tostring(i) to convert the index from a number to a string, as if it were a dictionary, but that also fails.
1 Like
Apparently putting the indexes into tonumbers() fixes it. I would love to know why.
print(Chunks)
print(Chunks[tonumber(i)])
print(Chunks[tonumber(i)][tonumber(o)])
if Chunks[tonumber(i)][tonumber(o)][1]=="R" then
local Level=Chunks[tonumber(i)][tonumber(o)][2]
if Level>1 then
chunk=Downscale(chunk,Level)
end
end
EDIT: Apperently using pairs() gives a string index, while using ipairs() gives you an int index.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.