Hey, I'm brand new to love2d. How do you get the contents of a file?
[[ Context: I'm making a game where you need a password to play. The password gets saved if it's Correct. How do I read the password back to the game so users dont have to re-enter the password. ]]
P.S: I Checked the forums, and it said something about returns, and I honestly have no idea how to use return. I've been using lua for about 2 years and I got no idea how to use returns.
How to Get file contents
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: How to Get file contents
Not to read, to check if the file exists.. This is to readBrotSagtMist wrote: ↑Thu Dec 01, 2022 11:03 pm Dude i just literally gave you the code in another thread.
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: How to Get file contents
The function used is literally named read() what do you expect it does?
obey
Re: How to Get file contents
Hi
I suggest to get familiar with basic concepts of Lua and Löve.
Otherwise you will constantly run into obstacles or do things in very weird and cumbersome ways.
For example using a function that reads a file can be super confusing if you do not yet know how functions work in general.
On the wiki is a list of tutorials, both texts and videos:
https://love2d.org/wiki/Category:Tutorials
This one seems good: https://sheepolution.com/learn/book/contents
In chapter 3 it explains functions and functions with return values.
Who is online
Users browsing this forum: No registered users and 6 guests