local Table = {1,2,3,4,"FDS",5,6,7,8,9,10}
local Result = nil
local FirstNums = {}
local LastNums = {}
local OtherNum = {}
for i,v in pairs(Table) do
if tonumber(v) then
if table.getn(LastNums) == 0 then
table.insert(LastNums,v)
table.insert(FirstNums,v)
else
if (FirstNums[table.getn(FirstNums)] + 1) == v then
table.insert(LastNums,v)
else
table.insert(OtherNum,v)
end
end
else
print("NOT A NUMBER")
end
end
for i = 1,table.getn(FirstNums) do
if (FirstNums[i] + 1) == LastNums[i] then
print(FirstNums[i].."-"..LastNums[i])
else
for _,v in pairs(OtherNum) do
print(v)
end
end
end
doesn't print any errors
Output:
NOT A NUMBER 3 4 5 6 7 8 9 10

2 comments
maybe your if statements are wrapped in () when they are unnecessary!
No, it worked before with the () around the FirstNums + 1, but i dont know why it isnt working anymore