How do you use lua libraries?
I have created a custom library consisting of only helper functions. I have tried to 'include' the file using 'require "libname" ' but I get the error below:
The library is located in the same directory as the init.lua of the mod. It seems like it is not looking in the mod's directory. Any suggestions? Thanks.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
10:53:00: ERROR[main]: ...jects/Repos/minetest/bin/../mods/modname/init.lua:35: module 'libname' not found:
10:53:00: ERROR[main]: no field package.preload['libname']
10:53:00: ERROR[main]: no file './libname.lua'
10:53:00: ERROR[main]: no file '/usr/local/share/lua/5.1/libname.lua'
10:53:00: ERROR[main]: no file '/usr/local/share/lua/5.1/libname/init.lua'
10:53:00: ERROR[main]: no file '/usr/local/lib/lua/5.1/libname.lua'
10:53:00: ERROR[main]: no file '/usr/local/lib/lua/5.1/libname/init.lua'
10:53:00: ERROR[main]: no file '/home/user/ownCloud/Projects/Repos/minetest/bin/../mods/modname.lua'
10:53:00: ERROR[main]: no file './libname.so'
10:53:00: ERROR[main]: no file '/usr/local/lib/lua/5.1/libname.so'
10:53:00: ERROR[main]: no file '/usr/local/lib/lua/5.1/libname.so'
The library is located in the same directory as the init.lua of the mod. It seems like it is not looking in the mod's directory. Any suggestions? Thanks.