The 'local' keyword makes the variable local to the code block it's in. Simply redeclare that variable in the scope you need it available. hunmonk On Monday, November 26, 2012 at 8:29 AM, Archana Venugopan wrote:
Hi,
Does anyone know how can we use a variable declared inside if statement outside if block?
if sip_request_user == nil then sip_request_user = params:getHeader("sip_request_user") else local sip_request_user1 = tonumber(sip_request_user) end
In my lua I have something like above and I want to use the variable sip_request_user1 outside if. What can be done?
Regards, Archana
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org (mailto:consulting@freeswitch.org) http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org (mailto:FreeSWITCH-users@lists.freeswitch.org) http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org