playground/lua/tables.lua

23 lines
309 B
Lua

-- Check if a table has another table in it
function is_nested_table(t)
for _, value in pairs(t) do
if type(value) == 'table' then
return true
end
end
return false
end
-- Write and read to a table
t = {}
n = io.read()
for i=1,n do
t[i] = io.read()
end
for i=1,n do
print(t[i])
end