Open magnusviri opened 2 years ago
Thanks for the PR! I'm afraid I don't really understand the implications of this as it pertains to the various versions of Lua and LuaJIT. I'm going to have to get someone to help me review so please be patient.
I changed it back to the old way but then I check if the file exists, if debug is a table, and if debug.getinfo is a function before using it.
If the library loading path is changed with something like
love.filesystem.setRequirePath('?.lua;lib/?.lua;lib/?/init.lua;lib/?/?.lua')
then this code will fail:local pathToThisFile = (...):gsub("%.", "/") .. ".lua"
It will work if changed to the following.
local pathToThisFile = debug.getinfo(1).source:match("@?(.*)")
See this documentation for information about debug.getinfo.
Note, I believe in Lua 5.2+
...
in a required file would be the name of the module and the path of the file. However, Love 11 includes Lua 5.1, which means...
is only the name of the module (see this).