Page 1 of 1

newThread filename path restrictions

Posted: Sun Jun 04, 2023 7:59 pm
by Nikki
Hiya,

I'm running into an issue with newThread()
my code base is organised in a way where i have a shared folder with reusable code called lib for many different apps to use:

Code: Select all

root/
  lib/
  all_the_apps/
    app1/
       main.lua
    app2/
    	main.lua

for this to work nicely i just add a

Code: Select all

package.path = package.path .. ";../../?.lua"
Now i have a nicely threaded piece of code that handles my audio system, and I would like to put that piece of code in the 'lib/' folder, but newThread is not having it.
It basically does'nt allow to look for a file that would end up outside, in the parent of the love folder where the main.lua is itself. Basically the limitation of lua filesystem I believe.

anyway, is there something i can do about this ? I don't really wanna have to copy this single file in all the various app folders and keep track of changing all of them in the future.

Re: newThread filename path restrictions

Posted: Sun Jun 04, 2023 10:11 pm
by zorg
It's not just newThread, you also can't use .. in require or any of the other new* functions either.
As far as löve is concerned, the filesystem root starts where your project's main.lua is, and anything outside that doesn't exist.

(I'm actually suprised if that package path modification works for you with require)