lm_connection.c
changeset 19 d775d7289fe4
parent 16 09b375e9ce32
child 23 13f03e604c8a
equal deleted inserted replaced
18:6effa1929af7 19:d775d7289fe4
   227 		lua_pushnumber (L, lm_connection_get_keep_alive_rate (object->connection));
   227 		lua_pushnumber (L, lm_connection_get_keep_alive_rate (object->connection));
   228 		return 1;
   228 		return 1;
   229 #else
   229 #else
   230 		W ("Sorry, your loudmouth have no get_keep_alive_rate ()");
   230 		W ("Sorry, your loudmouth have no get_keep_alive_rate ()");
   231 		lua_pushnil (L);
   231 		lua_pushnil (L);
   232 		lua_pushstring (L, "Sorry, your loudmouth have no get_keep_alive_rate ()");
   232 		lua_pushliteral (L, "Sorry, your loudmouth have no get_keep_alive_rate ()");
   233 		return 2;
   233 		return 2;
   234 #endif
   234 #endif
   235 	}
   235 	}
   236 }
   236 }
   237 
   237 
   554 };
   554 };
   555 
   555 
   556 int luaopen_lm_connection (lua_State *L)
   556 int luaopen_lm_connection (lua_State *L)
   557 {
   557 {
   558 	luaL_newmetatable (L, "loudmouth.connection");
   558 	luaL_newmetatable (L, "loudmouth.connection");
   559 	lua_pushstring (L, "__index");
   559 	lua_pushvalue (L, -1);
   560 	lua_pushvalue (L, -2);
   560 	lua_setfield (L, -2, "__index");
   561 	lua_settable (L, -3);
       
   562 	luaL_register (L, NULL, reg_m_lm_connection);
   561 	luaL_register (L, NULL, reg_m_lm_connection);
   563 	lua_pop (L, 1);
   562 	lua_pop (L, 1);
   564 	lua_newtable (L); // XXX we can specify here exact amount of fields
   563 	lua_newtable (L); // XXX we can specify here exact amount of fields
   565 	luaL_register (L, NULL, reg_f_lm_connection);
   564 	luaL_register (L, NULL, reg_f_lm_connection);
   566 	return 1;
   565 	return 1;