You are missing the closing end
of the for
loop, which causes the insert
line to be inside the loop. You need to add it:
for name,tbl in pairs(players) do
if tbl.wins>most.wins then
most={name=name,wins=tbl.wins}
end
end -- <---- add this
table.insert(log.cheese, "<j><b>"..most.name.."</b> <vp>won the round for gathering <ROSE><b>"..most.wins.." cheese!</b><N>")
You probably also have an extra end
at the end (otherwise your code wouldn't compile), which you will need to remove.