Lua Patch

lua-users home

luapatch is a Pure Lua implementation of the Unix patch utility (unified diffs only).

Web Site


This is a Lua implementation of the patch utility [1]. It only supports unified diffs (diff -u).

A main motivation of this utility is to provide a platform-independent, easily deployable, and simple patch utility for LuaRocks [2].


For help:

./patch.lua --help

To patch current directory using patch file "mypatch":

./patch.lua < mypatch



This code is new should undergo further testing. Some of the style might be further improved as it was converted from Python.

Note: Those code in the direct port is fairly ugly. It is being largely rewritten. If you want it sooner, just ask.


(c) 2008 David Manura, Licensed under the same terms as Lua (MIT license). Code is heavilly based on the Python-based version 8.06-1, Copyright (c) 2008, MIT License . See included LICENSE.txt file.

Note: the source reuses Lua optparse (CommandLineParsing) and EnhancedFileLines (DavidManura).

See Also

Related documentation and implementations on patch:

RecentChanges · preferences
edit · history
Last edited August 19, 2010 3:39 am GMT (diff)