Can't make require function work [SOLVED]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Can't make require function work

Post by kikito »

airstruck wrote: Are you running Debian? I had the impression this was something weird the Debian package maintainers did, and it didn't affect other platforms. I'm not sure it's Lua's fault; as far as I know they don't make any recommendation for what exactly should go in package.path (from LUA_PATH or luaconf.h), so it's just up to package maintainers to do something sensible.
I am not, I'm on OSX. I am pretty sure this is Lua. They could have included '?/init.lua' in the definition of LUA_PATH_DEFAULT long time ago, but for some reason it isn't there.
When I write def I mean function.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Can't make require function work

Post by airstruck »

kikito wrote: I am not, I'm on OSX. I am pretty sure this is Lua. They could have included '?/init.lua' in the definition of LUA_PATH_DEFAULT long time ago, but for some reason it isn't there.
It's right there on lines 195 and 209, isn't it?

It looks like it's been there since 2013, which should mean that default setting made it into 5.3 at least. In any case, it's strange that OP reports it doesn't work in Love, since Love's default require path does include ?/init.lua (see getRequirePath and setRequirePath). In my experience ?/init.lua works fine in Love, as the wiki suggests.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 81 guests