Got some fairly common lua functions that I'd like to use as a library. I note that there is a "require" feature in lua, but that requires modification of the environment variables. I was wondering if there isn't a simpler "include" type mechanism where I can specify the full path of a lua script?
dofile "/usr/local/freeswitch/scripts/my_functions.lua"
works. But it seems to only take an absolute path. If you find another way, that would be great. Oh, and if you could wikifiy that... -Avi On Wed, Jun 20, 2012 at 11:24 AM, Alex <alex@thewinelake.com> wrote:
Got some fairly common lua functions that I'd like to use as a library. I note that there is a "require" feature in lua, but that requires modification of the environment variables. I was wondering if there isn't a simpler "include" type mechanism where I can specify the full path of a lua script?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: 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
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list 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
Actually, a little more digging and I found that the standard lua environment is OK - it looks in various places by default. However, I I may well try your thing - I wonder if that doesn't use the modular approach though... I have updated the wiki...
dofile "/usr/local/freeswitch/scripts/my_functions.lua"
works. But it seems to only take an absolute path. If you find another way, that would be great. Oh, and if you could wikifiy that...
-Avi
On Wed, Jun 20, 2012 at 11:24 AM, Alex <alex@thewinelake.com <mailto:alex@thewinelake.com>> wrote:
Got some fairly common lua functions that I'd like to use as a library. I note that there is a "require" feature in lua, but that requires modification of the environment variables. I was wondering if there isn't a simpler "include" type mechanism where I can specify the full path of a lua script?
_________________________________________________________________________ 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
Join Us At ClueCon - Aug 7-9, 2012
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: 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
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list 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
No virus found in this message. Checked by AVG - www.avg.com <http://www.avg.com> Version: 2012.0.2177 / Virus Database: 2437/5080 - Release Date: 06/19/12
I put my libs in the same dir as the rest of the FS Lua scripts and have this in my lua.conf.xml <param name="script-directory" value="$${base_dir}/scripts/?.lua"/> then I can just require 'foo' in my scripts, without specifying a path regards, Leon On Jun 20, 2012, at 10:24, Alex wrote:
Got some fairly common lua functions that I'd like to use as a library. I note that there is a "require" feature in lua, but that requires modification of the environment variables. I was wondering if there isn't a simpler "include" type mechanism where I can specify the full path of a lua script?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: 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
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list 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
participants (3)
-
Alex
-
Avi Marcus
-
Leon de Rooij