Skip to main content

diff

Functionality to generate the differences between two strings.

diff.changes

a

(field) a: string?

b

(field) b: string?

tag

(field) tag: "delete"|"equal"|"insert"|"modify"

diff

function diff.diff(a: table<integer, string>, b: table<integer, string>)
-> diff.changes[]

Generate the differences between two tables of strings.


diff_iter

function diff.diff_iter(a: table<integer, string>, b: table<integer, string>)
-> fun():diff.changes

Same as diff.diff(...) but in iterable mode.


inline_diff

function diff.inline_diff(a: string, b: string)
-> diff.changes[]

Generates the differences between two strings.


split

function diff.split(str: string, mode?: "char"|"line")
-> table<integer, string>

Split a string by the given mode ready for consumption by diff.diff(...).

mode:
| "char"
| "line"