looking for examples of how to use love.filesystem.getInfo()

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
rd_
Prole
Posts: 5
Joined: Fri Jul 26, 2019 9:12 pm

looking for examples of how to use love.filesystem.getInfo()

Post by rd_ »

Hi, I'm trying to update some examples of the recursiveEnumerate function found on the BYTEPATH tutorial and also on the love wiki. I got a message that love.filesystem.isFile and love.filesystem.isDirectory have been replaced with love.filesystem.getInfo
Using the wiki, I couldn't figure out how to differentiate a file from a folder, but searching around the forums I think I found a way. Is there another place I can look for examples of love.filesystem.getInfo? These are the examples that I clipped:

Code: Select all

love.filesystem.getInfo(file, 'file')
love.filesystem.getInfo(file, 'directory')
This is the code that I'm trying to update, can't tell if I did it correctly though because I'm still learning and there are probably some errors elsewhere in my main.lua:

Code: Select all

function recursiveEnumerate(folder, fileTree)
    local filesTable = love.filesystem.getDirectoryItems(folder)
    for i,v in ipairs(filesTable) do
        local file = folder..'.'..v
        if love.filesystem.getInfo(file, 'file') then
            table.insert(fileTree, file)
        elseif love.filesystem.getInfo(file, 'directory') then
            recursiveEnumerate(file, fileTree)
        end
    end
end
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: looking for examples of how to use love.filesystem.getInfo()

Post by zorg »

yep, from a first glance that should be indeed how it works now. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 3 guests