Why does love accept "for k, file"? Where is file defined? Does love understand what a file is? Is file an internal pointer command?
Where can I find information of special words like these that are so generic they pop up everywhere within the documentation which makes them really hard to search for? What do you even call them?
Code: Select all
local dir = ""
--assuming that our path is full of lovely files (it should at least contain main.lua in this case)
local files = love.filesystem.getDirectoryItems(dir)
for k, file in ipairs(files) do
print(k .. ". " .. file) --outputs something like "1. main.lua"
end
Code: Select all
for line in files:lines() do
name = string.match(line, '%a+')
number = tonumber(string.match(line,'%d+'))
numbers[d] = {activity, timeofactivity}
end