diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2013-04-17 19:13:28 -0700 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2013-04-17 19:13:28 -0700 |
commit | 00435529bb9a3a6614e9934fe20c27ada3dc2283 (patch) | |
tree | db1e6c023b75b19bb8d761c3d8df576cd6b4d5cd /src/url.lua | |
parent | d548a78e5516bcc85d44f1d419cf53c71d6dcd79 (diff) | |
parent | 56893e9dcd1eeebffb42b227a2151e18d49bc370 (diff) | |
download | luasocket-00435529bb9a3a6614e9934fe20c27ada3dc2283.tar.gz luasocket-00435529bb9a3a6614e9934fe20c27ada3dc2283.tar.bz2 luasocket-00435529bb9a3a6614e9934fe20c27ada3dc2283.zip |
Merge pull request #32 from ideka/unstable
Use the length operator (#) instead of table.getn.
Diffstat (limited to 'src/url.lua')
-rw-r--r-- | src/url.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/url.lua b/src/url.lua index 1bfecad..6ca6d68 100644 --- a/src/url.lua +++ b/src/url.lua | |||
@@ -259,7 +259,7 @@ function parse_path(path) | |||
259 | path = path or "" | 259 | path = path or "" |
260 | --path = string.gsub(path, "%s", "") | 260 | --path = string.gsub(path, "%s", "") |
261 | string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end) | 261 | string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end) |
262 | for i = 1, table.getn(parsed) do | 262 | for i = 1, #parsed do |
263 | parsed[i] = unescape(parsed[i]) | 263 | parsed[i] = unescape(parsed[i]) |
264 | end | 264 | end |
265 | if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end | 265 | if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end |
@@ -277,7 +277,7 @@ end | |||
277 | ----------------------------------------------------------------------------- | 277 | ----------------------------------------------------------------------------- |
278 | function build_path(parsed, unsafe) | 278 | function build_path(parsed, unsafe) |
279 | local path = "" | 279 | local path = "" |
280 | local n = table.getn(parsed) | 280 | local n = #parsed |
281 | if unsafe then | 281 | if unsafe then |
282 | for i = 1, n-1 do | 282 | for i = 1, n-1 do |
283 | path = path .. parsed[i] | 283 | path = path .. parsed[i] |