diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 06:16:43 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 06:16:43 +0000 |
commit | 694edcc3c1ac3041ff8cdd753a2f7894e8783e6c (patch) | |
tree | f8797b4c7671fbf9042fc011277d69d4c3549045 /samples | |
parent | bf738a03368b8de9c574d9631f131c5a520acf7b (diff) | |
download | luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.gz luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.bz2 luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.zip |
Committing with require.
Diffstat (limited to 'samples')
-rw-r--r-- | samples/cddb.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/samples/cddb.lua b/samples/cddb.lua index 6ade3c0..0ed7c71 100644 --- a/samples/cddb.lua +++ b/samples/cddb.lua | |||
@@ -8,7 +8,7 @@ local server = arg[3] or "http://freedb.freedb.org/~cddb/cddb.cgi" | |||
8 | function parse(body) | 8 | function parse(body) |
9 | local lines = string.gfind(body, "(.-)\r\n") | 9 | local lines = string.gfind(body, "(.-)\r\n") |
10 | local status = lines() | 10 | local status = lines() |
11 | local _, _, code, message = string.find(status, "(%d%d%d) (.*)") | 11 | local code, message = socket.skip(2, string.find(status, "(%d%d%d) (.*)")) |
12 | if tonumber(code) ~= 210 then | 12 | if tonumber(code) ~= 210 then |
13 | return nil, code, message | 13 | return nil, code, message |
14 | end | 14 | end |
@@ -16,7 +16,7 @@ function parse(body) | |||
16 | for l in lines do | 16 | for l in lines do |
17 | local c = string.sub(l, 1, 1) | 17 | local c = string.sub(l, 1, 1) |
18 | if c ~= '#' and c ~= '.' then | 18 | if c ~= '#' and c ~= '.' then |
19 | local _, _, key, value = string.find(l, "(.-)=(.*)") | 19 | local key, value = socket.skip(2, string.find(l, "(.-)=(.*)")) |
20 | value = string.gsub(value, "\\n", "\n") | 20 | value = string.gsub(value, "\\n", "\n") |
21 | value = string.gsub(value, "\\\\", "\\") | 21 | value = string.gsub(value, "\\\\", "\\") |
22 | value = string.gsub(value, "\\t", "\t") | 22 | value = string.gsub(value, "\\t", "\t") |