diff options
author | Iordan Iordanov <iiordanov@gmail.com> | 2011-11-05 17:23:36 +0000 |
---|---|---|
committer | Iordan Iordanov <iiordanov@gmail.com> | 2011-11-05 17:23:36 +0000 |
commit | f9765334339e7d4c264df9029e8f6d5d82c1506c (patch) | |
tree | 97514a672e491fab99d441d64bfb02b90bf25e50 /applications/luci-pbx/luasrc/model/cbi | |
parent | 773de62fd34de4e3dbce3f5148425dd4a84599bc (diff) |
1) Got rid of mysplit and replaced where it was called with luci.util.split(luci.util.trim(...), ...) calls.
Diffstat (limited to 'applications/luci-pbx/luasrc/model/cbi')
-rw-r--r-- | applications/luci-pbx/luasrc/model/cbi/pbx.lua | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/applications/luci-pbx/luasrc/model/cbi/pbx.lua b/applications/luci-pbx/luasrc/model/cbi/pbx.lua index f3a23b6a42..13cbcd569d 100644 --- a/applications/luci-pbx/luasrc/model/cbi/pbx.lua +++ b/applications/luci-pbx/luasrc/model/cbi/pbx.lua @@ -19,6 +19,7 @@ modulename = "pbx" + if nixio.fs.access("/etc/init.d/asterisk") then server = "asterisk" elseif nixio.fs.access("/etc/init.d/freeswitch") then @@ -27,19 +28,6 @@ else server = "" end --- My implementation of the function which splits a string into tokens --- at the specified separator and returns a table containing the tokens. -function mysplit(inputstr, sep) - if sep == nil then - sep = "%s" - end - t={} ; i=1 - for str in string.gmatch(inputstr, "([^"..sep.."]+)") do - t[i] = str - i = i + 1 - end - return t -end -- Returns formatted output of string containing only the words at the indices -- specified in the table "indices". @@ -49,12 +37,12 @@ function format_indices(string, indices) end -- Split input into separate lines. - lines = mysplit(string, "\n") + lines = luci.util.split(luci.util.trim(string), "\n") -- Split lines into separate words. splitlines = {} for lpos,line in ipairs(lines) do - splitlines[lpos] = mysplit(line, " ") + splitlines[lpos] = luci.util.split(luci.util.trim(line), "%s+", nil, true) end -- For each split line, if the word at all indices specified |