This is my first time creating a luarock and writing .rockpec
file. I have a small lua script and some static text files that this script requires to use. How should I pack my luarock so that these static files are available for my script?
For example, here is my myscript.rockspeck
file:
package = "myscript"
version = "1.0-1"
source = {
url = "https://github.com/me/myscript/raw/master/myscript-1.0.tar.gz",
tag = "v1.0"
}
description = {
summary = "My script.",
detailed = [[
Some lua script.
]],
homepage = "https://github.com/me/myscript",
license = "MIT"
}
dependencies = {
"lua >= 5.1, < 5.4"
}
build = {
type = "builtin",
modules = {
myfun = "src/myscript.lua"
},
copy_directories = {"my_data"}
}
I am able to do :
luarocks pack myscript-1.0-1.rockspec
sudo luarocks install myscript-1.0-1.src.rock
However, upon importing myfun
module I can see that the my_data
directory with the required files inside is not accessible by the module as it complains accordingly.
When I do laurocks pack
my working directory contains myscript-1.0.tar.gz
with the following sctructure:
myscript-1.0/
src/myscript.lua
tiny_data/
data1.txt
data2.txt
How should I correctly include my_data
static files?