From 56893e9dcd1eeebffb42b227a2151e18d49bc370 Mon Sep 17 00:00:00 2001 From: Gerardo Marset Date: Mon, 25 Feb 2013 20:28:28 -0200 Subject: 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 --- samples/lpr.lua | 2 +- samples/tinyirc.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'samples') 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 do local opt = {} local pat = "[%s%c%p]*([%w]*)=([\"]?[%w%s_!@#$%%^&*()<>:;]+[\"]\?\.?)" - for i = 2, table.getn(arg), 1 do + for i = 2, #arg, 1 do string.gsub(arg[i], pat, function(name, value) opt[name] = value end) end 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() insert = function(set, value) if not reverse[value] then table.insert(set, value) - reverse[value] = table.getn(set) + reverse[value] = #set end end, remove = function(set, value) -- cgit v1.2.3-55-g6feb