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.
-
Lovingsoul1337
- Prole
- Posts: 32
- Joined: Fri Feb 21, 2020 1:26 pm
Post
by Lovingsoul1337 » Mon May 11, 2020 6:11 pm
Hey there can you may help me ? For some reason i can't read the file and it doesnt print love
Code: Select all
local littlehelper = {}
function littlehelper.requireSystems()
local systemTable = {}
local systemName
for k, v in ipairs(love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")) do
print("Love")
systemName = "SimpleElementSystem.Systems." .. v:gsub("%.lua", "")
table.insert(systemTable, require(systemName))
end
return systemTable --intendation of this return good ?
end
return littlehelper
best regards
Michael
-
MrFariator
- Party member
- Posts: 193
- Joined: Wed Oct 05, 2016 11:53 am
Post
by MrFariator » Mon May 11, 2020 7:28 pm
As far as I know, love.filesystem paths are in the format of path/to/file only, so path.to.file doesn't work.
You may also want to be mindful of the exact casing on folder and file names; for example running code on Windows works fine if you mix the cases, but will fail when running from a .love or fused executable.
-
pgimeno
- Party member
- Posts: 2414
- Joined: Sun Oct 18, 2015 2:58 pm
Post
by pgimeno » Mon May 11, 2020 8:04 pm
Yeah, dots are used for module names in require(). Normal love.filesystem functions use slashes "/".
Users browsing this forum: ditas and 32 guests