From 0eb59a85bfad833922f221a44fc90ce5a9a4f8b6 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 2 Jan 2021 12:30:27 +0100 Subject: [PATCH] Fix table.difference (fix for cellestial) --- table.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/table.lua b/table.lua index 4ce7dff..e88c41d 100644 --- a/table.lua +++ b/table.lua @@ -288,16 +288,18 @@ end contains = find -function difference(table, other_table) - local result = {} - for key, value in pairs(other_table) do - if table[value] ~= value then - result[key] = value +function to_add(table, after_additions) + local additions = {} + for key, value in pairs(after_additions) do + if table[key] ~= value then + additions[key] = value end end - return result + return additions end +difference = to_add + function add_all(table, additions) for key, value in pairs(additions) do table[key] = value