When using Lua to build IVR applications or serving configurations, you would likely need to install some dependencies. This page contains some of the most common dependencies.
Installing LuaSocket - Installing LuaSocket
Some Lua packages installed via apt-get, yum, rpms, (or other package managers) might be installed in places that aren't in the default Lua package search path. If you encounter an error while trying to require a new library, like this...
2016-12-29 21:56:45.507805 [ERR] mod_lua.cpp:203 /var/fs/scripts/somescript.lua:1: module 'somelibrary.lua' not found: no field package.preload['somelibrary.lua'] no file '/var/fs/scripts/somelibrary/lua.lua' no file '/usr/local/lib/lua/5.2/somelibrary/lua.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.2/somelibrary/lua.so' no file '/usr/lib/lua/5.2/somelibrary/lua.so' no file '/usr/local/lib/lua/5.2/loadall.so' no file './somelibrary/lua.so' no file '/usr/local/lib/lua/5.2/somelibrary.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.2/somelibrary.so' no file '/usr/lib/lua/5.2/somelibrary.so' no file '/usr/local/lib/lua/5.2/loadall.so' no file './somelibrary.so' |
... then you may have to append to Lua's default package search path.
You can add arbitrary paths to Lua's package search path as follows:
package.path = package.path .. ";" .. [[/usr/share/lua/5.2/?.lua]] |
Simply add that line to the top of your Lua script before requiring anything.