2018-07-31から1日間の記事一覧

Lua、Python / 排列を逆順に並べ換える

Luaの場合: function table.reverse(tbl) local len = #tbl local temp = {} for i = len, 1, -1 do temp[#temp+1] = tbl[i] end return temp end -- test -- do local lst = {"a", "b", "c", "d"} local rev = table.reverse(lst) print(table.concat(rev, …