10 posts
Posted 28 November 2014 - 11:09 PM
Asking because I'm having difficulty with this and I really want a method other than loading the file as an API.
53 posts
Location
Somewhere in ****** County, *******
Posted 28 November 2014 - 11:17 PM
fileHandle=fs.open("folder/file.txt","r") --"r" as the second argument opens the file in read mode
text=fileHandle.readAll()
fileHandle.close()
The file will be stored in the variable text.
797 posts
Posted 28 November 2014 - 11:32 PM
Watch out for if the file doesn't exist. If it doesn't exist, you'll get an "attempt to call nil" error where you are calling fileHandle.readAll().
10 posts
Posted 28 November 2014 - 11:39 PM
Thank you.