From b15171305b5e6e9b1da4dc05c4d7e105980b9d9d Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Tue, 22 Apr 2008 18:01:41 +0000 Subject: * Fixed ffluci.util.trim, ffluci.util.split --- core/src/ffluci/util.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/src/ffluci/util.lua b/core/src/ffluci/util.lua index 9cb1e1420..3ff7bc203 100644 --- a/core/src/ffluci/util.lua +++ b/core/src/ffluci/util.lua @@ -153,6 +153,10 @@ function split(str, pat, max, regex) local t = {} local c = 1 + if #str == 0 then + return {""} + end + if #pat == 0 then return nil end @@ -172,8 +176,9 @@ function split(str, pat, max, regex) end -- Removes whitespace from beginning and end of a string -function trim (string) - return string:gsub("^%s*(.-)%s*$", "%1") +function trim(string) + local s = string:gsub("^%s*(.-)%s*$", "%1") + return s end -- Updates given table with new values -- cgit v1.2.3