[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua Conference Bot 0.1
- From: David Given <dg@...>
- Date: Thu, 23 Jul 2009 23:28:29 +0100
-----BEGIN PGP SIGNED MESSAGE-----
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:
http://www.cowlark.com/gaim-citadel
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!
- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "People who think they know everything really annoy those of us who
│ know we don't." --- Bjarne Stroustrup
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFKaOQNf9E0noFvlzgRAjCrAJ9zjoBBatPlZ0x34tapeiF9yinSJQCeM7Us
zuZlRd4Jt/fy74M4g2MuXmI=
=2rRH
-----END PGP SIGNATURE-----