I am making a project with lua that gets a list of all the file names from your desktop in lua. however, I can't figure out how to do it, and I am also going to be using love2d for it, because it is going to be a game. can you tell me how to do it? thanks!
Here is the code
function love.load()
require "player"
-- Lets add Some Variables!
-- Some Directory Suff first for Variables...
DesktopDirectory = love.filesystem.getUserDirectory().."Desktop"
DesktopFiles = love.filesystem.getDirectoryItems(DesktopDirectory)
-- These are the Images!
images = {
background = love.graphics.newImage("gfx/desktop.png")
}
players = {Player.New(50, 300, 40, 40, "gfx/stickman.png", true)}
love.graphics.setBackgroundColor(100, 220, 255)
for k in pairs(DesktopFiles) do
print(DesktopFiles[k])
end
end
function love.keypressed(k)
if k == "j" then
players[1].jump()
end
end
function love.update(dt)
for i in pairs(players) do
players[i].update()
end
end
function love.draw()
love.graphics.draw(images.background)
for i in pairs(players) do
players[i].draw()
end
end