From 1d13fd503a8f593dec339eacf2378b88a23ed653 Mon Sep 17 00:00:00 2001 From: "Mr. Stradivarius" Date: Mon, 14 Jul 2014 19:32:33 +0900 Subject: [PATCH] Simplify mw.text.listToText Simplify the logic in mw.text.listToText so that we don't need to add or remove anything from the original table we were passed. Change-Id: I3efcbba1b9adc9a9e32e366e355cb742376cd91b --- engines/LuaCommon/lualib/mw.text.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engines/LuaCommon/lualib/mw.text.lua b/engines/LuaCommon/lualib/mw.text.lua index 01914421..e639228c 100644 --- a/engines/LuaCommon/lualib/mw.text.lua +++ b/engines/LuaCommon/lualib/mw.text.lua @@ -240,10 +240,7 @@ function mwtext.listToText( list, separator, conjunction ) local ret if n > 1 then - local tmp = list[n-1] - list[n-1] = list[n-1] .. conjunction .. list[n] - ret = table.concat( list, separator, 1, n - 1 ) - list[n-1] = tmp + ret = table.concat( list, separator, 1, n - 1 ) .. conjunction .. list[n] else ret = tostring( list[1] or '' ) end