aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorGerardo Marset <gammer1994@gmail.com>2013-02-25 20:28:28 -0200
committerGerardo Marset <gammer1994@gmail.com>2013-02-25 20:28:28 -0200
commit56893e9dcd1eeebffb42b227a2151e18d49bc370 (patch)
treedb1e6c023b75b19bb8d761c3d8df576cd6b4d5cd /samples
parentd548a78e5516bcc85d44f1d419cf53c71d6dcd79 (diff)
downloadluasocket-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 'samples')
-rw-r--r--samples/lpr.lua2
-rw-r--r--samples/tinyirc.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/samples/lpr.lua b/samples/lpr.lua
index 2b059b1..3d5e2f8 100644
--- a/samples/lpr.lua
+++ b/samples/lpr.lua
@@ -29,7 +29,7 @@ end
29do 29do
30 local opt = {} 30 local opt = {}
31 local pat = "[%s%c%p]*([%w]*)=([\"]?[%w%s_!@#$%%^&*()<>:;]+[\"]\?\.?)" 31 local pat = "[%s%c%p]*([%w]*)=([\"]?[%w%s_!@#$%%^&*()<>:;]+[\"]\?\.?)"
32 for i = 2, table.getn(arg), 1 do 32 for i = 2, #arg, 1 do
33 string.gsub(arg[i], pat, function(name, value) opt[name] = value end) 33 string.gsub(arg[i], pat, function(name, value) opt[name] = value end)
34 end 34 end
35 if not arg[2] then 35 if not arg[2] then
diff --git a/samples/tinyirc.lua b/samples/tinyirc.lua
index e75851f..5babb7e 100644
--- a/samples/tinyirc.lua
+++ b/samples/tinyirc.lua
@@ -31,7 +31,7 @@ function newset()
31 insert = function(set, value) 31 insert = function(set, value)
32 if not reverse[value] then 32 if not reverse[value] then
33 table.insert(set, value) 33 table.insert(set, value)
34 reverse[value] = table.getn(set) 34 reverse[value] = #set
35 end 35 end
36 end, 36 end,
37 remove = function(set, value) 37 remove = function(set, value)