Skip to content

Instantly share code, notes, and snippets.

@JaHIY
Created January 2, 2015 16:23
Show Gist options
  • Save JaHIY/48103a399db830fabdff to your computer and use it in GitHub Desktop.
Save JaHIY/48103a399db830fabdff to your computer and use it in GitHub Desktop.
reverse file written in lua
#!/usr/bin/env lua
--[[
for line in io.lines(arg[0]) do
print(string.reverse(line))
end
--]]
local file = io.open(arg[0], "r")
file:seek("end", -1)
while true do
io.write(file:read(1))
if file:seek("cur", -2) == nil then
break
end
end
file:close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment