M
M
MrFredber2021-07-20 07:57:22
Lua
MrFredber, 2021-07-20 07:57:22

Is it possible to set the require function to an absolute path in Lua?

Hello. I need to define a library using require. It's located in the path "/fos/apps/settings.app/modules/personalization/main.lua"
The problem is that the script is in the "settings.app" folder (the real folder) and require converts this part of the string to "settings /app", which I absolutely do not need.
You cannot rename a folder.
Is it possible to bypass dot-to-slash conversion or set an absolute path?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2021-07-20
@MrFredber

Try like this:

package.path = package.path .. ";/fos/apps/settings.app/modules/personalization"
require "main.lua"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question