lm_connection.c
changeset 63 c17f3295f52c
parent 54 6bef2082e5f9
equal deleted inserted replaced
62:d92358eafead 63:c17f3295f52c
   185 /// R: integer (when called with no args) or lm connection object
   185 /// R: integer (when called with no args) or lm connection object
   186 static int port_lm_connection (lua_State *L)
   186 static int port_lm_connection (lua_State *L)
   187 {
   187 {
   188 	llm_connection_t *object = luaL_checklm_connection (L, 1);
   188 	llm_connection_t *object = luaL_checklm_connection (L, 1);
   189 	if (lua_gettop (L) > 1) { // Set
   189 	if (lua_gettop (L) > 1) { // Set
   190 		lm_connection_set_port (object->connection, luaL_checkint (L, 2));
   190 		lm_connection_set_port (object->connection, luaL_checkinteger (L, 2));
   191 		lua_pop (L, 1);
   191 		lua_pop (L, 1);
   192 	} else { // Get
   192 	} else { // Get
   193 		lua_pushnumber (L, lm_connection_get_port (object->connection));
   193 		lua_pushnumber (L, lm_connection_get_port (object->connection));
   194 	}
   194 	}
   195 	return 1;
   195 	return 1;
   235 /// integer (when called with no args) or lm connection object or nil, string (error message, when get function is not available in loudmouth)
   235 /// integer (when called with no args) or lm connection object or nil, string (error message, when get function is not available in loudmouth)
   236 static int keep_alive_rate_lm_connection (lua_State *L)
   236 static int keep_alive_rate_lm_connection (lua_State *L)
   237 {
   237 {
   238 	llm_connection_t *object = luaL_checklm_connection (L, 1);
   238 	llm_connection_t *object = luaL_checklm_connection (L, 1);
   239 	if (lua_gettop (L) > 1) { // Set
   239 	if (lua_gettop (L) > 1) { // Set
   240 		lm_connection_set_keep_alive_rate (object->connection, luaL_checkint (L, 2));
   240 		lm_connection_set_keep_alive_rate (object->connection, luaL_checkinteger (L, 2));
   241 		lua_pop (L, 1);
   241 		lua_pop (L, 1);
   242 		return 1;
   242 		return 1;
   243 	} else { // Get
   243 	} else { // Get
   244 #ifdef HAVE_LM_CONNECTION_GET_KEEP_ALIVE_RATE
   244 #ifdef HAVE_LM_CONNECTION_GET_KEEP_ALIVE_RATE
   245 		lua_pushnumber (L, lm_connection_get_keep_alive_rate (object->connection));
   245 		lua_pushnumber (L, lm_connection_get_keep_alive_rate (object->connection));