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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
ThatCodingGuy78
Prole
Posts: 16
Joined: Thu May 27, 2021 12:32 am

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

Post 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
"There is no such thing as a mistake, only happy accidents"
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 27 guests