#!/usr/bin/env luajit -- this is the "wrong" way to do this... package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "src/lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path local utility = require "utility" local sort_arrays sort_arrays = function(tab) for key, value in pairs(tab) do if type(value) == "table" then sort_arrays(value) end end if tab[1] then table.sort(tab) end end local file_name = arg[1] local data = utility.load_data(file_name) sort_arrays(data) utility.save_data(data)