Skip to content

Commit

Permalink
Delim: Strip leading and following spaces from input
Browse files Browse the repository at this point in the history
  • Loading branch information
smurfier committed Nov 26, 2012
1 parent 5eb13e8 commit 4048c4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion @Resources/CScript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Delim(input, sep) -- Separates an input string by a delimiter
test(type(input) == 'string', 'Delim: input must be a string. Received %s instead', type(input))
if sep then test(type(sep) == 'string', 'Delim: sep must be a string. Received %s instead', type(sep)) end
local tbl = {}
for word in input:gmatch('[^' .. (sep or '|') ..']+') do table.insert(tbl, word) end
for word in input:gmatch('[^' .. (sep or '|') .. ']+') do table.insert(tbl, word:match('^%s*(.-)%s*$')) end
return tbl
end -- SetLabels

Expand Down

0 comments on commit 4048c4b

Please sign in to comment.