equal
deleted
inserted
replaced
47 static int new_lm_proxy (lua_State *L) |
47 static int new_lm_proxy (lua_State *L) |
48 { |
48 { |
49 int type = luaL_checkenum (L, 1, type_lm_proxy); |
49 int type = luaL_checkenum (L, 1, type_lm_proxy); |
50 LmProxy *proxy; |
50 LmProxy *proxy; |
51 if (lua_gettop (L) > 0) |
51 if (lua_gettop (L) > 0) |
52 proxy = lm_proxy_new_with_server (type, luaL_checkstring (L, 2), luaL_checkint (L, 3)); |
52 proxy = lm_proxy_new_with_server (type, luaL_checkstring (L, 2), luaL_checkinteger (L, 3)); |
53 else |
53 else |
54 proxy = lm_proxy_new (type); |
54 proxy = lm_proxy_new (type); |
55 bless_lm_proxy (L, proxy); |
55 bless_lm_proxy (L, proxy); |
56 lm_proxy_unref (proxy); // XXX |
56 lm_proxy_unref (proxy); // XXX |
57 D ("Proxy %p created", proxy); |
57 D ("Proxy %p created", proxy); |
105 /// R: integer (when called with no args) or lm proxy object |
105 /// R: integer (when called with no args) or lm proxy object |
106 static int port_lm_proxy (lua_State *L) |
106 static int port_lm_proxy (lua_State *L) |
107 { |
107 { |
108 llm_proxy_t *object = luaL_checklm_proxy (L, 1); |
108 llm_proxy_t *object = luaL_checklm_proxy (L, 1); |
109 if (lua_gettop (L) > 1) { // Set |
109 if (lua_gettop (L) > 1) { // Set |
110 lm_proxy_set_port (object->proxy, luaL_checkint (L, 2)); |
110 lm_proxy_set_port (object->proxy, luaL_checkinteger (L, 2)); |
111 lua_pop (L, 1); |
111 lua_pop (L, 1); |
112 } else // Get |
112 } else // Get |
113 lua_pushnumber (L, lm_proxy_get_port (object->proxy)); |
113 lua_pushnumber (L, lm_proxy_get_port (object->proxy)); |
114 return 1; |
114 return 1; |
115 } |
115 } |