The return_data table is being used by table.concat to join a string of
returned items. Since accepted trade items were not being set in this
table, it left gaps so the array part was only valid to the first
accepted item slot.
This caused two issues:
- Depending on the gaps in the return item table, concat could error
which would halt any event_trade that used it. For example if an
item was accepted in slot 1 (t[1] nil) with a returned item in t[2],
concat errored: `invalid value (nil) at index 1 in table for 'concat'`.
Since this error only occurs with some gaps, it may be an edge case
with lua 5.1 that was fixed in later versions.
- Any returned items that were traded in slots after the first accepted
trade slot were not added to the returned item string for player events
This will make the Lua items module and Perl check_handin plugin not
return items consumed by source task delivery updates when source is
patched to restore sending delivered task items in EVENT_TRADE.
Note the trade plugins do not handle item stacks so if a trade slot is
consumed by a plugin check, any extra items in the stack will not be
returned even if not all were used by a task update.