what im trying to do is getting the value of an nil index, like if there was only 3 values in the table and i tried to index a 4th index in the table. it would return the 1st value; index a 5th index = 2nd value. i know i can just subtract the index by the length of the table, but that wont work for most indexes.
local array = {10,30,40,50,60}
print(array[6]) -- i want it to print the first index which is 10
print(array[7]) -- 30
print(array[8]) -- 40
-- i can only index with a nil index up to a 10th index until it returns nil using index - #array
print(array[11-#array]) -- nil
print(array[10-#array]) -- 60

2 comments
Nil indices have no value.
can u read my question again