local numbers = {1, 2, 3, 4, 5}
-- 标准库中没有 filter:
-- 循环把通过检验的元素放进新数组
local odd_items = {}
for _, number in ipairs(numbers) do
if number % 2 == 1 then
odd_items[#odd_items + 1] = number
end
end
-- odd_items = 1, 3, 5
print("odd_items = "
.. table.concat(odd_items, ", "))