From 9977943966abbc7d1daa32046c25a9e4554e6da4 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 23:19:07 +1000 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 eb92aea..a480e85 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 @@ -288,7 +291,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