diff --git a/lua/SpecSwitcher/ExtensionMap.lua b/lua/SpecSwitcher/ExtensionMap.lua index c4225e7..f57c103 100644 --- a/lua/SpecSwitcher/ExtensionMap.lua +++ b/lua/SpecSwitcher/ExtensionMap.lua @@ -4,6 +4,7 @@ function ExtMap:new (o) o = o or {} setmetatable(o, self) self.__index = self + self["list"] = {} return o end @@ -23,6 +24,21 @@ function ExtMap:add_single (in_ext, out_ext) self[in_ext] = {out_ext} end end + + local in_exists = false + for _, exts in pairs(self["list"]) do + if exts == in_ext then + in_exists = true + end + end + + if in_exists == false then + table.insert(self["list"], in_ext) + end +end + +function ExtMap:list_exts() + return self["list"] end function ExtMap:add (in_exts, out_exts)