math.randomseed(os.time()) --global words table words = {} --function to process a file. returns a table function process_file(f) local t = {} for line in io.lines(f) do if line ~= "" then t[#t+1] = line end end return t end --function to load up the dictionaries function load_words() for i = 1, 11, 1 do words[i] = process_file(i.."vowels") end end --function to get a word randomly function get_word(nv) return words[nv][math.random(#words[nv])] end --function to process a program - outputs to stdout function process_program(f) for line in io.lines(f) do for num in string.gmatch(line, "%d+") do io.write(get_word(tonumber(num)).." ") end io.write("\n") end end --main function function main() load_words() if arg[1] then process_program(arg[1]) else print("ERROR: Name of program to encode required!") print() print("USAGE: lua "..arg[0].." ") end end main()