Decorate-sort-undecorate idiom: Difference between revisions
Content added Content deleted
(Added Lua version) |
m (→{{header|Lua}}) |
||
Line 596: | Line 596: | ||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
Lua's 'table.sort' accepts a custom compare function as a second argument. |
|||
<syntaxhighlight lang="lua">-- Decorate, sort, undecorate function |
<syntaxhighlight lang="lua">-- Decorate, sort, undecorate function |
||
function dsu (tab, keyFunc) |
function dsu (tab, keyFunc) |