TableUtil.lua 221 Bytes Edit Raw Blame History 1 2 3 4 5 6 7 8 9 10 11 12 13 14 function table.arrayToMap(tab) local len = #tab local result = {} for i = 1, len, 2 do result[tab[i]] = tab[i + 1] end return result end function table.clear(tab) for k, _ in pairs(tab) do tab[k] = nil end end