I am trying to make a script that can take a table with tons of values, and put the last 10 values of that table into a new table. My code is below. Anyone know why it won’t work?
Edit: I am getting no errors, and the new table ends up having more than 10 values.
for x, v in ipairs(infoTable) do
if x >= #infoTable - 10 then
table.insert(newTable, 1, v)
end
end
Read as: move elements from 10 back from the total number of elements in the source elements to the total number of elements in the source table to index 1 and counting of the destination table.