From 9b934599d84f0b3dd32cda657790dc2c34bd95d8 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 26 May 2009 16:00:59 +0000 Subject: Updates for alpine 1.9 apk tools and openrc. Bug fix for format.lua string_to_table. --- lib/format.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/format.lua') 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 -- cgit v1.2.3