Configuring path for require()
Posted: Friday 17 April 2020 16:56
How can I config the path to modules I want to include with "require()"?
The only hint I found in the forum is:
package.path = package.path .. ';' .. '/home/pi/domoticz/scripts/lua/?.lua'
but that's I have to do for every script!?
Another way seems to put it in /usr/local/lib/lua/5.3, but than it is
- in a different directory
- not easy to handle, because in the normal way (saving from an editor) permisson is not allowed. You need admin rights!
So what is a usabel way.? Perhaps I would prefer to store it in /home/pi/domoticz/scripts/lua/lib so all scripts are in the same directory environment. Bad idea? And how to say domoticz to laod modules from therre in a general way?
I have little linux know how and starting with domoticz and lua. Is there a tutorial or complete documentation using lua in domoticz? I only found the wiki and the workbook. But there are things like this not described.
Thanks
The only hint I found in the forum is:
package.path = package.path .. ';' .. '/home/pi/domoticz/scripts/lua/?.lua'
but that's I have to do for every script!?
Another way seems to put it in /usr/local/lib/lua/5.3, but than it is
- in a different directory
- not easy to handle, because in the normal way (saving from an editor) permisson is not allowed. You need admin rights!
So what is a usabel way.? Perhaps I would prefer to store it in /home/pi/domoticz/scripts/lua/lib so all scripts are in the same directory environment. Bad idea? And how to say domoticz to laod modules from therre in a general way?
I have little linux know how and starting with domoticz and lua. Is there a tutorial or complete documentation using lua in domoticz? I only found the wiki and the workbook. But there are things like this not described.
Thanks