The regex is messed up:
|
for snipName in line:gmatch("%s(.+)") do -- %s space .+ one or more non-empty sequence |
%s(.+) is matched greedily, which means that everything after snippet becomes part of the name; you end up with a snippet that has spaces in its name. Instead, you want %s(%S+) so that you split up spaces and non-spaces.