Implement set and call

Signed-off-by: Rahix <rahix@rahix.de>
dev
rahix 7 years ago
parent 3508870c7f
commit f9a14ecaeb

@ -157,7 +157,21 @@ function BaseControl:get(noun, timeout)
end end
function BaseControl:set(name, value) function BaseControl:set(name, value)
error("set unimplemented") if self.locals.nouns[name] ~= nil then
if type(value) == "function" then
error("\""..name.."\" can't be cast into a verb")
else
self.locals.nouns[name] = value
end
elseif self.locals.verbs[name] ~= nil then
if type(value) ~= "function" then
error("\""..name.."\" can't be cast into a noun")
else
self.locals.verbs[name] = value
end
else
error("\""..name.."\" is not a local")
end
end end
-- }}} -- }}}
@ -176,7 +190,11 @@ function BaseControl:verbs(local_only)
end end
function BaseControl:call(verb, ...) function BaseControl:call(verb, ...)
error("call unimplemented") if self.locals.verbs[verb] ~= nil then
self.locals.verbs[verb](...)
else
error("unknown verb")
end
end end
-- }}} -- }}}
-- }}} -- }}}

Loading…
Cancel
Save