awesome-wm-widgets/_snippets/ellipsize.md

15 lines
247 B
Markdown

---
layout: page
---
# Ellipsize
>Ellipsizes string to a given length
{:.filename}
```lua
local function ellipsize(text, length)
return (text:len() > length and length > 0)
and text:sub(0, length - 3) .. '...'
or text
end
```