From 9f5dfcb9237260bdfe3702cd3eaf04dc392568fa Mon Sep 17 00:00:00 2001 From: Max Cahill <1bardesign@gmail.com> Date: Thu, 23 Jun 2022 16:36:54 +1000 Subject: [PATCH] removed needless branch in tablex.shallow_copy --- tablex.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tablex.lua b/tablex.lua index 1301e67..677f55a 100644 --- a/tablex.lua +++ b/tablex.lua @@ -333,14 +333,11 @@ end -- See shallow_overlay to shallow copy into an existing table to avoid garbage. function tablex.shallow_copy(t) assert:type(t, "table", "tablex.shallow_copy - t", 1) - if type(t) == "table" then - local into = {} - for k, v in pairs(t) do - into[k] = v - end - return into + local into = {} + for k, v in pairs(t) do + into[k] = v end - return t + return into end --alias