这种方式只用遍历table一次,效果不错
function isArrayTable(t)
if type(t) ~= "table" then
return false
end
local n = #t
for i,v in pairs(t) do
if type(i) ~= "number" then
return false
end
if i > n then
return false
end
end
return true
end