#!/usr/local/bin/lua-- $Id: reversefile.lua,v 1.3 2001/05/14 01:52:38 doug Exp $ -- http://www.bagley.org/~doug/shootout/ local lines = {} local w = write nl = 0 gsub(read("*a"), "([^\n]+\n)", function (l) %lines[nl] = l nl = nl + 1 end) nl = nl - 1 for i=nl,0,-1 do w(lines[i]) end