diff options
author | Gerardo Marset <gammer1994@gmail.com> | 2013-02-25 20:28:28 -0200 |
---|---|---|
committer | Gerardo Marset <gammer1994@gmail.com> | 2013-02-25 20:28:28 -0200 |
commit | 56893e9dcd1eeebffb42b227a2151e18d49bc370 (patch) | |
tree | db1e6c023b75b19bb8d761c3d8df576cd6b4d5cd /etc | |
parent | d548a78e5516bcc85d44f1d419cf53c71d6dcd79 (diff) | |
download | luasocket-56893e9dcd1eeebffb42b227a2151e18d49bc370.tar.gz luasocket-56893e9dcd1eeebffb42b227a2151e18d49bc370.tar.bz2 luasocket-56893e9dcd1eeebffb42b227a2151e18d49bc370.zip |
Use the length operator (#) instead of table.getn.
table.getn was deprecated in Lua 5.1 in favor of #, the length operator.
See: http://www.lua.org/manual/5.1/manual.html#7.2
Diffstat (limited to 'etc')
-rw-r--r-- | etc/check-links.lua | 2 | ||||
-rw-r--r-- | etc/dispatch.lua | 2 | ||||
-rw-r--r-- | etc/forward.lua | 2 | ||||
-rw-r--r-- | etc/get.lua | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/etc/check-links.lua b/etc/check-links.lua index d2e4266..283f3ac 100644 --- a/etc/check-links.lua +++ b/etc/check-links.lua | |||
@@ -11,7 +11,7 @@ dispatch.TIMEOUT = 10 | |||
11 | 11 | ||
12 | -- make sure the user knows how to invoke us | 12 | -- make sure the user knows how to invoke us |
13 | arg = arg or {} | 13 | arg = arg or {} |
14 | if table.getn(arg) < 1 then | 14 | if #arg < 1 then |
15 | print("Usage:\n luasocket check-links.lua [-n] {<url>}") | 15 | print("Usage:\n luasocket check-links.lua [-n] {<url>}") |
16 | exit() | 16 | exit() |
17 | end | 17 | end |
diff --git a/etc/dispatch.lua b/etc/dispatch.lua index cc8cb23..31a1290 100644 --- a/etc/dispatch.lua +++ b/etc/dispatch.lua | |||
@@ -76,7 +76,7 @@ local function newset() | |||
76 | insert = function(set, value) | 76 | insert = function(set, value) |
77 | if not reverse[value] then | 77 | if not reverse[value] then |
78 | table.insert(set, value) | 78 | table.insert(set, value) |
79 | reverse[value] = table.getn(set) | 79 | reverse[value] = #set |
80 | end | 80 | end |
81 | end, | 81 | end, |
82 | remove = function(set, value) | 82 | remove = function(set, value) |
diff --git a/etc/forward.lua b/etc/forward.lua index 9073ac4..05ced1a 100644 --- a/etc/forward.lua +++ b/etc/forward.lua | |||
@@ -3,7 +3,7 @@ local dispatch = require("dispatch") | |||
3 | local handler = dispatch.newhandler() | 3 | local handler = dispatch.newhandler() |
4 | 4 | ||
5 | -- make sure the user knows how to invoke us | 5 | -- make sure the user knows how to invoke us |
6 | if table.getn(arg) < 1 then | 6 | if #arg < 1 then |
7 | print("Usage") | 7 | print("Usage") |
8 | print(" lua forward.lua <iport:ohost:oport> ...") | 8 | print(" lua forward.lua <iport:ohost:oport> ...") |
9 | os.exit(1) | 9 | os.exit(1) |
diff --git a/etc/get.lua b/etc/get.lua index 4196f00..9edc235 100644 --- a/etc/get.lua +++ b/etc/get.lua | |||
@@ -135,7 +135,7 @@ end | |||
135 | 135 | ||
136 | -- main program | 136 | -- main program |
137 | arg = arg or {} | 137 | arg = arg or {} |
138 | if table.getn(arg) < 1 then | 138 | if #arg < 1 then |
139 | io.write("Usage:\n lua get.lua <remote-url> [<local-file>]\n") | 139 | io.write("Usage:\n lua get.lua <remote-url> [<local-file>]\n") |
140 | os.exit(1) | 140 | os.exit(1) |
141 | else get(arg[1], arg[2]) end | 141 | else get(arg[1], arg[2]) end |