Skip to content

Commit d30f651

Browse files
idbriilpil
authored andcommitted
lua: Add assert
Standard lua assert message. msg is optional, so hide the ", " if it's omitted.
1 parent 24a9bf9 commit d30f651

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

UltiSnips/lua.snippets

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ snippet #! "#!/usr/bin/env lua" b
88
$0
99
endsnippet
1010

11+
snippet assert "Assertion" b
12+
assert(${1:condition}`!p
13+
if t[2]:
14+
snip.rv = ", "
15+
else:
16+
snip.rv = ""
17+
`${2:msg})
18+
endsnippet
19+
1120
snippet !fun(ction)?! "New function" br
1221
function ${1:new_function}(${2:args})
1322
$0

0 commit comments

Comments
 (0)