diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-03-25 10:27:27 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-03-25 10:27:27 +0100 |
commit | df6e17e48995f25e72509986f30700d778b179b6 (patch) | |
tree | f432c24b8e4ad81009188650dabfd99194883265 /misc/freeswitch/scripts/common/str.lua | |
parent | 11f186a118285fbc87a536af26730780a9ad01f5 (diff) | |
parent | cce94a74aa5c9691f9b37cd9be5a6831f8063812 (diff) |
Merge branch 'develop'5.1.2
Diffstat (limited to 'misc/freeswitch/scripts/common/str.lua')
-rw-r--r-- | misc/freeswitch/scripts/common/str.lua | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/misc/freeswitch/scripts/common/str.lua b/misc/freeswitch/scripts/common/str.lua index 541199f..3fd8fde 100644 --- a/misc/freeswitch/scripts/common/str.lua +++ b/misc/freeswitch/scripts/common/str.lua @@ -4,37 +4,6 @@ module(...,package.seeall) -function try(array, arguments) - if type(arguments) ~= 'string' or type(array) ~= 'table' then - return nil; - end - - local result = array; - - arguments:gsub('([^%.]+)', function(entry) - local success, result = pcall(function() result = (result[tonumber(entry) or entry]); end); - end); - - return result; -end - - -function set(array, arguments, value) - local nop, arguments_count = arguments:gsub('%.', ''); - local structure = array; - arguments:gsub('([^%.]+)', function(entry) - if arguments_count <= 0 then - structure[entry] = value; - elseif type(structure[entry]) == 'table' then - structure = structure[entry]; - else - structure[entry] = {}; - structure = structure[entry]; - end - arguments_count = arguments_count - 1; - end); -end - -- to number function to_n(value) value = tostring(value):gsub('[^%d%.%+%-]', ''); @@ -160,23 +129,3 @@ function append(buffer, value, separator, prefix, suffix) return buffer; end - --- concatenate array values to string -function concat(array, separator, prefix, suffix) - local buffer = ''; - for key, value in pairs(array) do - buffer = append(buffer, value, separator, prefix, suffix); - end - - return buffer; -end - --- concatenate array keys to string -function concat_keys(array, separator, prefix, suffix) - local buffer = ''; - for key, value in pairs(array) do - buffer = append(buffer, key, separator, prefix, suffix); - end - - return buffer; -end |