summaryrefslogtreecommitdiffstats
path: root/lib/format.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/format.lua')
-rw-r--r--lib/format.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/format.lua b/lib/format.lua
index 63b8fec..9492eca 100644
--- a/lib/format.lua
+++ b/lib/format.lua
@@ -175,10 +175,14 @@ function string_to_table ( text, delimiter)
while 1 do
local first, last = string.find(text, delimiter, pos)
if first then -- found?
- table.insert(list, string.sub(text, pos, first-1))
+ if first > pos then
+ table.insert(list, string.sub(text, pos, first-1))
+ end
pos = last+1
else
- table.insert(list, string.sub(text, pos))
+ if pos < string.len(text) then
+ table.insert(list, string.sub(text, pos))
+ end
break
end
end