RosettaCodeData/Task/Compare-length-of-two-strings/Lua/compare-length-of-two-strings.lua
2023-07-01 13:44:08 -04:00

5 lines
170 B
Lua

function test(list)
table.sort(list, function(a,b) return #a > #b end)
for _,s in ipairs(list) do print(#s, s) end
end
test{"abcd", "123456789", "abcdef", "1234567"}