--- a/main.c Wed Mar 31 00:12:21 2010 +0300
+++ b/main.c Wed Mar 31 00:28:04 2010 +0300
@@ -382,10 +382,13 @@
/// main.connection
/// Returns lightuserdata of mcabber's loudmouth connection.
/// This can be very useful with lua-loudmouth, and not much otherwise.
-/// R: lightuserdata
+/// R: lightuserdata or nil
static int lua_main_connection (lua_State *L)
{
- lua_pushlightuserdata (L, lconnection);
+ if (xmpp_is_online ())
+ lua_pushlightuserdata (L, lconnection);
+ else
+ lua_pushnil (L);
return 1;
}
#endif