summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-04 21:10:43 +0200
committerAki <nthirtyone@gmail.com>2017-09-04 21:10:43 +0200
commit87e0b1eb45117ced574df07534f6666470f218a7 (patch)
tree0aa26b18b087ead8d9eee8359b3c07e424ab9629
parent4f0a5df7c5a681a153967aca5142bdef65102a62 (diff)
downloadroflnauts-87e0b1eb45117ced574df07534f6666470f218a7.zip
roflnauts-87e0b1eb45117ced574df07534f6666470f218a7.tar.gz
roflnauts-87e0b1eb45117ced574df07534f6666470f218a7.tar.bz2
Minor getLocked and isUnique changes
-rw-r--r--not/Selector.lua13
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