summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor <pashev.igor@gmail.com>2011-02-21 11:50:29 +0300
committerIgor <pashev.igor@gmail.com>2011-02-21 11:50:29 +0300
commitfa27781d02045206442d76f380a23568d3a13336 (patch)
tree6a18b40a8208b9116d8ddc9801d101deba001d80
parent06e6300c6e0f16df5764b886089a92ca42a7868e (diff)
downloadgcd-fa27781d02045206442d76f380a23568d3a13336.tar.gz
local r; table.maxn -> #
-rwxr-xr-xgcd.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcd.lua b/gcd.lua
index 09a198c..43cfad9 100755
--- a/gcd.lua
+++ b/gcd.lua
@@ -14,8 +14,8 @@ function gcd2(a, b)
end
function gcdn(ns)
- r = ns[1]
- for i = 2, table.maxn(ns) do
+ local r = ns[1]
+ for i = 2, #ns do
r = gcd2(r, ns[i])
end
return r