Page 1 of 1

How do I use love.filesystem.read to read a .txt file?

Posted: Sun Jun 27, 2021 4:46 am
by ThatCodingGuy78
I tried using this function:

Code: Select all

function readConfigFile()
  local config = love.filesystem.read("config.txt")
  return config
end
But that doesn't work, it's just nil. I have no idea what I'm doing wrong here, the file's in the game directory.
Also, here's the code that accesses config.txt's data:

Code: Select all

print(tostring(readConfigFile()), 0, 0)
Ignore the weird print function, it's a function from another script that does some extra stuff besides just printing.

Edit: Nevermind, I forgot to actually put something in the .txt file. The reason I'm not deleting this is so another person who has my issue might be helped by this post