[Freeswitch-users] mod_lua and require

Boris Kovalenko boris at tagnet.ru
Tue Apr 19 08:34:50 MSD 2011


Hello!

     I want to include LUA script into another LUA script. I have 
modified lua.conf.xml and set <param name="script-directory" 
value="$${base_dir}/scripts/?"/> and restarted freeswitch. In my script 
called test1.lua I wrote: require('test2.lua');
test2.lua is placed into the same directory as test1.lua, and directory 
is /opt/fs/scripts/. But luarun test1.lua gives an error:
  2011-04-19 10:14:40.651205 [ERR] mod_lua.cpp:182 
/opt/fs/scripts/test1.lua:3: module 'test2.lua' not found:
         no field package.preload['test2.lua']
         no file '/opt/fs/scripts/test2/lua'
         no file './test2/lua.so'
         no file './libtest2/lua51.so'
         no file '/usr/local/lib/lua/5.1/test2/lua.so'
         no file '/usr/local/lib/lua/5.1/libtest2/lua51.so'
         no file '/usr/local/lib/lua/5.1/loadall.so'
         no file './test2.so'
         no file './libtest251.so'
         no file '/usr/local/lib/lua/5.1/test2.so'
         no file '/usr/local/lib/lua/5.1/libtest251.so'
         no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
         [C]: in function 'require'
         /opt/fs/scripts/test1.lua:3: in main chunk


What is wrong with my setup?

-- 
Regards,
Boris





More information about the FreeSWITCH-users mailing list