DEV Community

Thiago Massari Guedes
Thiago Massari Guedes

Posted on

LuSH 0.15 with syntax sugar

This new release of LuSH brings some interesting and important improvements (not officially supported by LUA), being:

String interpolation

local name = "Thiago"
env.print("My name is ${name}")
Enter fullscreen mode Exit fullscreen mode

String split

local items = string.split("string with spaces", " ")
Enter fullscreen mode Exit fullscreen mode

Shell exec

print("Lush scripts:")
$> ls scripts | grep ".lush"
Enter fullscreen mode Exit fullscreen mode

outputs:

Lush scripts:
mod1.lush
test2.lush
test3.lush
Enter fullscreen mode Exit fullscreen mode

Subshell exec

print("Lush scripts, again:")
local scripts = $( ls scripts | grep ".lush" )
local tok = string.split(scripts, '\n', false)
for i, v in ipairs(tok) do
    print(i .. ': ' .. v)
end
Enter fullscreen mode Exit fullscreen mode

outputs:

Lush scripts, again:
1: mod1.lush
2: test2.lush
3: test3.lush
Enter fullscreen mode Exit fullscreen mode

Installing:

To install, simply run:

cargo install lush
Enter fullscreen mode Exit fullscreen mode

Top comments (0)