I have a table "weather". I insert weather conditions for a particular day. I can't seem to write a function that prints the contents of "weather" (see below for things I've tried.
day = "Friday"
conditions = {"Sunny", "85", "windy"}
weather = {{}} --nested table
for k, v in pairs(conditions) do
weather[day] = {[k]=v}
end
I've tried two things to print the weather table and neither work.
for k, v in pairs(weather) do
print(k, v)
end
---- Output ---
1 table: 0x2542ae0
Friday table: 0x25431a0
This doesn't work either, but I thought it would
for k, v in pairs(weather) do
for l, w in pairs(v) do
print(l, w)
end
end
----Output----
3 windy