Merge pull request #913 from Blizzard/fix-translate

Fix subtle bug in table.translate
This commit is contained in:
Samuel Surtees 2017-10-10 23:33:35 +10:00 committed by GitHub
commit 798b72b7d4

View File

@ -401,12 +401,12 @@
if not translation then return {} end if not translation then return {} end
local result = {} local result = {}
for _, value in ipairs(arr) do for i = 1, #arr do
local tvalue local tvalue
if type(translation) == "function" then if type(translation) == "function" then
tvalue = translation(value) tvalue = translation(arr[i])
else else
tvalue = translation[value] tvalue = translation[arr[i]]
end end
if (tvalue) then if (tvalue) then
table.insert(result, tvalue) table.insert(result, tvalue)