--矩阵旋转90度 (顺时针)
local src = {
[1] = {1, 2, 3, "a"},[2] = {4, 5, 6, "b"},
[3] = {7, 8, 9, "c"},
}
local t = {}
local maxFlag = #src
for row,v in pairs(src) do
for col,num in pairs(v) do
local newRow = col
local newCol = maxFlag - row + 1
t[newRow] = t[newRow] or {}
t[newRow][newCol] = num
end
end
--[[
t = {
[1] = {7,4,1},
[2] = {8,5,2},
[3] = {9,6,3},
[4]={"c","b","a"},
}
]]