summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-08-04 21:14:48 +0200
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-08-04 21:14:48 +0200
commit0be846d7ffb5bff70c525214a8b7c0e4d14ce3ec (patch)
tree64c9bb22eb7ba304ecd60c3e61b7700597c2cc48 /modules/luci-base/luasrc
parentafc5d67207a361a4c1a31c9025fdd98ff13d9401 (diff)
ipkg.lua: compare_versions() Replace Lua Math Library call
function compare_versions(): replace Lua Math Library call with if clause Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/model/ipkg.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/model/ipkg.lua b/modules/luci-base/luasrc/model/ipkg.lua
index 976081b84..2e26bd7a1 100644
--- a/modules/luci-base/luasrc/model/ipkg.lua
+++ b/modules/luci-base/luasrc/model/ipkg.lua
@@ -211,7 +211,12 @@ function compare_versions(ver1, comp, ver2)
local av1 = util.split(ver1, "[%.%-]", nil, true)
local av2 = util.split(ver2, "[%.%-]", nil, true)
- for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do
+ local max = table.getn(av1)
+ if (table.getn(av1) < table.getn(av2)) then
+ max = table.getn(av2)
+ end
+
+ for i = 1, max, 1 do
local s1 = av1[i] or ""
local s2 = av2[i] or ""