Where Lua Looks For Modules

As with other programming languange, Lua can add functionality by using require statement. Path to search for modules defined by package.path and package.cpath settings.

package.path     :   Where Lua looks for .lua modules.
package.cpath  :   Where Lua looks for .so/.dll modules.

We can append the path like :

package.path = package.path..”;/home/user/lib/?.lua”

package.cpath = package.cpath..”;/home/user/lib/?.so”