From b392b69f8706220597d8f51116b00fbaa169a2f3 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 21:19:07 +0800 Subject: [PATCH] Adding ability for hooks to return, and OnRaw hook By adding the ability for hooks to return, we can stop the processing of a line at any point. This is used by the OnRaw hook such that any non-nil return value will cause the irc library to assume that line has been handled. --- init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 8d24df9..86ee879 100644 --- a/init.lua +++ b/init.lua @@ -163,7 +163,10 @@ end function meta:think() while true do local line = getline(self, 3) - if line then self:handle(parse(line)) + if line then + if not self:invoke("OnRaw", line) then + self:handle(parse(line)) + end else break end @@ -292,7 +295,7 @@ end function meta:handle(prefix, cmd, params) local handler = handlers[cmd] if handler then - handler(self, prefix, unpack(params)) + return handler(self, prefix, unpack(params)) end end