To know where to look for modules, Lua's require
uses the variables package.path
(.lua) and package.cpath
(.so/.dll). You can change them in your program to look in the directory you have it in. For consistency's sake, you can look at their contents to know which OS-specific separator to use. For example:
local sep = package.path:find("\\") and "\\" or "/"
package.path = package.path .. ";." .. sep .. "polygon" .. sep .. "?.lua"
This would include ./polygon/?.lua
into the search path, and a call to require "delaunay"
would therefore have the require function look for ./polygon/delaunay.lua
in addition to existing paths. Bear in mind that in require
strings, .
denotes a separator as far as file searching is concerned, so calling require "polygon.delaunay"
in this scenario will mean searching for ./polygon/polygon/delaunay.lua
.
From what I understand of your question, changing the package.path
variable to include the path to where your delaunay
library is stored would solve your issue, although to give a specific solution more information about your project and directory structure is required.