From a08ab4f93d058b65a8cff4523381ada56fab5824 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 6 Apr 2015 17:23:12 +0200 Subject: [PATCH] Refactor expand in Lua 5.1 --- md5.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/md5.lua b/md5.lua index 6c02f32..dc313b2 100644 --- a/md5.lua +++ b/md5.lua @@ -68,15 +68,10 @@ else return rslt end - local function expand(tbl_m, tbl_n) - local big = {} - local small = {} - if(#tbl_m > #tbl_n) then - big = tbl_m - small = tbl_n - else - big = tbl_n - small = tbl_m + local function expand(t1, t2) + local big, small = t1, t2 + if(#big < #small) then + big, small = small, big end -- expand small for i = #small + 1, #big do