aboutsummaryrefslogtreecommitdiff
path: root/etc/dict.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2005-11-22 08:33:29 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2005-11-22 08:33:29 +0000
commitd55a5826e81136a9ecf65c4cd407152a56684dc2 (patch)
tree109ad44c75cee890ad5e98583e12b15b5e65a18e /etc/dict.lua
parenta2b780bf7a78c66d54a248fa99b5fc862c12a127 (diff)
downloadluasocket-d55a5826e81136a9ecf65c4cd407152a56684dc2.tar.gz
luasocket-d55a5826e81136a9ecf65c4cd407152a56684dc2.tar.bz2
luasocket-d55a5826e81136a9ecf65c4cd407152a56684dc2.zip
Few tweaks in installation, some missing files, etc.
Diffstat (limited to 'etc/dict.lua')
-rw-r--r--etc/dict.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/etc/dict.lua b/etc/dict.lua
index 2d035a7..5c85aae 100644
--- a/etc/dict.lua
+++ b/etc/dict.lua
@@ -17,7 +17,7 @@ local tp = require("socket.tp")
17module("socket.dict") 17module("socket.dict")
18 18
19----------------------------------------------------------------------------- 19-----------------------------------------------------------------------------
20-- Globals 20-- Globals
21----------------------------------------------------------------------------- 21-----------------------------------------------------------------------------
22HOST = "dict.org" 22HOST = "dict.org"
23PORT = 2628 23PORT = 2628
@@ -39,7 +39,7 @@ end
39 39
40function metat.__index:check(ok) 40function metat.__index:check(ok)
41 local code, status = socket.try(self.tp:check(ok)) 41 local code, status = socket.try(self.tp:check(ok))
42 return code, 42 return code,
43 base.tonumber(socket.skip(2, string.find(status, "^%d%d%d (%d*)"))) 43 base.tonumber(socket.skip(2, string.find(status, "^%d%d%d (%d*)")))
44end 44end
45 45
@@ -101,7 +101,7 @@ local default = {
101} 101}
102 102
103local function there(f) 103local function there(f)
104 if f == "" then return nil 104 if f == "" then return nil
105 else return f end 105 else return f end
106end 106end
107 107
@@ -116,7 +116,7 @@ local function parse(u)
116 arg = string.gsub(arg, "^:([^:]+)", function(f) t.word = f end) 116 arg = string.gsub(arg, "^:([^:]+)", function(f) t.word = f end)
117 socket.try(t.word, "need at least <word> in URL") 117 socket.try(t.word, "need at least <word> in URL")
118 arg = string.gsub(arg, "^:([^:]*)", function(f) t.database = there(f) end) 118 arg = string.gsub(arg, "^:([^:]*)", function(f) t.database = there(f) end)
119 if cmd == "m" then 119 if cmd == "m" then
120 arg = string.gsub(arg, "^:([^:]*)", function(f) t.strat = there(f) end) 120 arg = string.gsub(arg, "^:([^:]*)", function(f) t.strat = there(f) end)
121 end 121 end
122 string.gsub(arg, ":([^:]*)$", function(f) t.n = base.tonumber(f) end) 122 string.gsub(arg, ":([^:]*)$", function(f) t.n = base.tonumber(f) end)
@@ -130,7 +130,7 @@ local function tget(gett)
130 local def = con:define(gett.database, gett.word) 130 local def = con:define(gett.database, gett.word)
131 con:quit() 131 con:quit()
132 con:close() 132 con:close()
133 if gett.n then return def[gett.n] 133 if gett.n then return def[gett.n]
134 else return def end 134 else return def end
135 elseif gett.command == "m" then 135 elseif gett.command == "m" then
136 local mat = con:match(gett.database, gett.strat, gett.word) 136 local mat = con:match(gett.database, gett.strat, gett.word)