lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hash: SHA1

Etan Reisner wrote:
> I would be very interested in this, people have often asked if they can
> write protocol plugins in non-C languages and the official answer is "not
> currently".

By popular demand:

I'd forgotten just how ancient it is (2006...); it uses Lua 5.0 and
doesn't build any more because it needs gaim-dev. But at least it's
available to study.

Technically there's not much to it --- it uses tolua to bind a (large)
subset of the gaim APIs. Most of the explicit C code is either setting
up and destroying the Lua environment, stub functions that just call
into Lua, or callbacks (Gaim was very callback-centric). On the Lua side
of things, each socket gets its own coroutine, and a simple scheduler
ensures that they all get a chance to read from their sockets whenever
Gaim kicks the plugin. I only bother to yield during pending reads,
assuming that writes will all happen quickly.

I hope this is some use to someone!

- --
┌─── ───── ─────
│ "People who think they know everything really annoy those of us who
│ know we don't." --- Bjarne Stroustrup
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -