On Wed, Dec 30, 2009 at 10:03 PM, Matthew Wild
<mwild1@gmail.com> wrote:
2009/12/30 Tiago Katcipis <tiagokatcipis@gmail.com>:
>
>
> Well I'm experienced with this other systems but i do not master them :-), i
> don't know if i will have a good idea of how to implement it on Lua, that's
> exactly why I'm trying to get some help from you guys.
>
I'm not sure 100% exactly what you're aiming for, but in Prosody we
wrote a small events library. It allows adding handlers to, and
triggering events identified by strings. It also allows you to add a
"priority" to the handlers, to loosely define the order they get
called in. Returning any value other than nil from a handler will halt
the processing of the event and return that value to the code that
fired the event.
The code is at http://hg.prosody.im/trunk/file/tip/util/events.lua
with documentation at http://prosody.im/doc/developers/util/events .
Also take a look at http://lua-users.org/wiki/LuaDesignPatterns for an
alternative (but similar) implementation.
Thanks Matthew, i think this will help a lot, i will read it carefully and soon i give some feedback here.
Matthew