diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-04 21:10:43 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-04 21:10:43 +0200 |
commit | 87e0b1eb45117ced574df07534f6666470f218a7 (patch) | |
tree | 0aa26b18b087ead8d9eee8359b3c07e424ab9629 | |
parent | 4f0a5df7c5a681a153967aca5142bdef65102a62 (diff) | |
download | roflnauts-87e0b1eb45117ced574df07534f6666470f218a7.zip roflnauts-87e0b1eb45117ced574df07534f6666470f218a7.tar.gz roflnauts-87e0b1eb45117ced574df07534f6666470f218a7.tar.bz2 |
Minor getLocked and isUnique changes
-rw-r--r-- | not/Selector.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/not/Selector.lua b/not/Selector.lua index 896f98f..fa00286 100644 --- a/not/Selector.lua +++ b/not/Selector.lua @@ -55,22 +55,21 @@ function Selector:getSelected () end --- Checks if selection is locked and returns item's value. --- @return false if not locked, value from list if locked +-- Nil returning part is there to clarify method's behaviour. +-- @return nil if not locked, value from list if locked function Selector:getLocked () if self.locked then return self:getSelected() end - return false + return nil end --- Checks if Selected value is unique in group's scope. function Selector:isUnique () if self.group then - local locked = group:callEachBut(self, "getLocked") - for _,lock in pairs(locked) do - if lock then - return false - end + -- In this case next is used to determine if table returned by call is empty. + if next(group:callEachBut(self, "getLocked")) then + return false end end return true |