Change. Use only require to load function.

Fix. Remove multiple definition of same function.
This commit is contained in:
Alexey Melnichuk
2015-08-10 12:43:06 +04:00
parent 7e481f20b6
commit a8142f527a
64 changed files with 207 additions and 400 deletions

View File

@@ -37,11 +37,11 @@
require "resources.functions.config";
--connect to the database
dofile(scripts_dir.."/resources/functions/database_handle.lua");
require "resources.functions.database_handle";
dbh = database_handle('system');
--settings
dofile(scripts_dir.."/resources/functions/settings.lua");
require "resources.functions.settings";
settings = settings(domain_uuid);
storage_type = "";
storage_path = "";
@@ -151,16 +151,8 @@
end
end
--define explode
function explode ( seperator, str )
local pos, arr = 0, {}
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
pos = sp + 1 -- jump past current divider
end
table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider
return arr
end
--define the explode function
require "resources.functions.explode"
--define a function to convert dialpad letters to numbers
function dialpad_to_digit(letter)
@@ -193,16 +185,11 @@
return count
end
--define trim
function trim (s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
--define the trim function
require "resources.functions.trim"
--check if a file exists
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
require "resources.functions.file_exists"
--define select_entry function
function select_entry()
@@ -261,7 +248,7 @@
end
status = dbh:query(sql, function(field)
--add functions
dofile(scripts_dir.."/resources/functions/base64.lua");
require "resources.functions.base64";
--set the voicemail message path
file_location = voicemail_dir.."/"..row.extension.."/recorded_name.wav";