How to merge two tables overwriting the elements which are in both?

lua, lua-table, merge

Solution

for k,v in pairs(second_table) do first_table[k] = v end

Problem

I need to merge two tables, with the contents of the second overwriting contents in the first if a given item is in both. I looked but the standard libraries don't seem to offer this. Where can I get such a function?

Original source

Related problems