--- a/src/lua_objs.c Tue Mar 31 20:33:45 2009 +0300
+++ b/src/lua_objs.c Tue Mar 31 20:57:07 2009 +0300
@@ -88,9 +88,29 @@
return 1;
}
+/**
+ * Send a PRIVMSG to the channel
+ */
+static int lua_chan_say (lua_State *L)
+{
+ err_t err;
+
+ struct lua_chan *lua_chan = lua_obj_get_obj(L, __func__, "evirc.chan");
+
+ // the message
+ const char *message = luaL_checkstring(L, 2);
+
+ // send
+ if ((err = irc_chan_PRIVMSG(lua_chan->chan, message)))
+ return luaL_error(L, "irc_chan_PRIVMSG: '%s': %s", message, error_name(err));
+
+ // ok
+ return 0;
+}
static const struct luaL_Reg lua_chan_methods[] = {
{ "__tostring", &lua_chan_tostring },
+ { "say", &lua_chan_say },
{ NULL, NULL },
};