Hi,
I want to group my code into subdirectories because things are getting cluttered in the root.
I want something like this;
root:
main.lua
code:
scenes:
scene1.lua
scene2.lua
scene3.lua
utils:
graphicsUtils.lua
databaseUtils.lua
I can see how to call scene1.lua from main.lua using require with the “.” to specify the subdirectory
But once executing the scene1.lua code, require seems to become “relative” to that file’s location.
How do I require code in a parent directory.
For example, inside scene1.lua I want to require graphicsUtils.lua
So I guess I am asking Either;
Is it possible to specify the parent directory, like in unix I would do; “…/utils/graphicsUtils.lua”
OR is there a way of specifying an absolute path for require, such that it starts again in root, in unix; “/utils/graphicsUtils.lua”
I would prefer to specify absolute paths, that way they are the same throughout the project.
I thought I could avoid the whole problem by manipulating package.path and although this worked on the simulator, it broke on the device.