diff --git a/src/nat/SelectionCommands.kiss b/src/nat/SelectionCommands.kiss index 8764517..40fd5a3 100644 --- a/src/nat/SelectionCommands.kiss +++ b/src/nat/SelectionCommands.kiss @@ -81,4 +81,4 @@ // so Cats may be the canonical name (defSelectCommand SelectByName [name (Text null)] - (nameSystem.getEntries name)) \ No newline at end of file + (nameSystem.getEntries archive name)) \ No newline at end of file diff --git a/src/nat/systems/NameSystem.kiss b/src/nat/systems/NameSystem.kiss index b641f55..78b8400 100644 --- a/src/nat/systems/NameSystem.kiss +++ b/src/nat/systems/NameSystem.kiss @@ -1,6 +1,6 @@ (load "../Lib.kiss") -(prop :Map> entriesByName (new Map)) +(prop :Map> entriesByName (new Map)) // Stores a case-insensitive map of named entries, for instant lookup by name (defNew [] @@ -9,13 +9,13 @@ ->[archive e] (hasComponent e Name) ->[archive e &opt ui] (let [name (readComponent e Name)] (if (entriesByName.exists (name.toLowerCase)) - (.push (dictGet entriesByName (name.toLowerCase)) e) - (dictSet entriesByName (name.toLowerCase) [e])) + (dictSet (dictGet entriesByName (name.toLowerCase)) e.id true) + (dictSet entriesByName (name.toLowerCase) [=>e.id true])) // Because the if statement doesn't unify by type :( null))) -(method :Array getEntries [name] +(method :Array getEntries [:nat.Archive archive name] (let [entries (dictGet entriesByName (name.toLowerCase))] (if entries - entries + (for id (entries.keys) (dictGet archive.entries id)) []))) \ No newline at end of file