local prevfile = require "prevfile" local nextfile = {} function nextfile.splitfilename(path) dir, name, ext = path:match("^(.*/)(.*)(%.%w*)") return dir, name, ext end function nextfile.nextfile(directory) local previous = prevfile.prevfile(directory) if previous == nil then return nil end local dir, name, ext = nextfile.splitfilename(previous) print(dir) print(name) print(ext) return "" end return nextfile