Small refactor

Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
rahix 2019-04-17 02:55:15 +02:00
parent 50ae923ef7
commit e8ec24dacc

4
bc.lua
View file

@ -280,8 +280,7 @@ function BaseControl:set(name, value)
local old = self.local_nouns[name] local old = self.local_nouns[name]
self.local_nouns[name] = value self.local_nouns[name] = value
if self.listeners[name] ~= nil then for id, l in pairs(self.listeners[name] or {}) do
for id, l in pairs(self.listeners[name]) do
if (l.query.ty == Query.Change.ty and value ~= old) if (l.query.ty == Query.Change.ty and value ~= old)
or (l.query.ty == Query.Rising.ty and value > old) or (l.query.ty == Query.Rising.ty and value > old)
or (l.query.ty == Query.Falling.ty and value < old) or (l.query.ty == Query.Falling.ty and value < old)
@ -302,7 +301,6 @@ function BaseControl:set(name, value)
end end
end end
end end
end
elseif self.local_verbs[name] ~= nil then elseif self.local_verbs[name] ~= nil then
if type(value) ~= "function" then if type(value) ~= "function" then
error("\""..name.."\" can't be cast into a noun") error("\""..name.."\" can't be cast into a noun")