love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")

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.
Post Reply
Lovingsoul1337
Prole
Posts: 32
Joined: Fri Feb 21, 2020 1:26 pm

love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")

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

Re: love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")

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.

User avatar
pgimeno
Party member
Posts: 2414
Joined: Sun Oct 18, 2015 2:58 pm

Re: love.filesystem.getDirectoryItems("SimpleElementSystem.Systems")

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 "/".

Post Reply

Who is online

Users browsing this forum: ditas and 32 guests