more stuff too lazy to seperate

This commit is contained in:
2023-11-24 21:38:31 -05:00
parent ebf9d2d1c4
commit f35b13d669
33 changed files with 488 additions and 246 deletions

View File

@ -54,4 +54,26 @@ ls.add_snippets('c', {
}
)
),
s({
name = 'Variadic function parser',
trig = 'infinite vars',
dscr = 'Parse an infinite number of arguments passed to a function',
},
{
t({
"/*",
" * NOTE: the function must have a int before the ... argument",
" * and you need to include <stdarg.h> for this to work",
" */",
"va_list ptr;",
"va_start(ptr, ", i(1, "n"),
");",
"for (int i = 0; i < ", ri(1),
"; i++) {",
i(2),
"}",
"va_end(ptr);",
}),
}
)
})