How to check for a file

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
xcrvaz
Prole
Posts: 7
Joined: Thu Nov 17, 2022 12:33 am

How to check for a file

Post by xcrvaz »

Hey there! I'm new to love2d, and I would like to find out how to check if a file exists. I checked the wiki but it was a bit confusing.
[Slight information:
You need a password to play my game, and I made it so it adds a file that stores the password if its correct, how do I check if this file exists or not when entering the password. ]
User avatar
BrotSagtMist
Party member
Posts: 604
Joined: Fri Aug 06, 2021 10:30 pm

Re: How to check for a file

Post by BrotSagtMist »

Code: Select all

password=love.filesystem.read("file" )
if password then 
 rungame()
else 
 nopassword()
end
 
obey
xcrvaz
Prole
Posts: 7
Joined: Thu Nov 17, 2022 12:33 am

Re: How to check for a file

Post by xcrvaz »

BrotSagtMist wrote: Thu Dec 01, 2022 10:11 pm

Code: Select all

password=love.filesystem.read("file" )
if password then 
 rungame()
else 
 nopassword()
end
 
Thanks!
Post Reply

Who is online

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