You can save them via file writing:
local filehandle = io.open("saveddata", "w") -- open to write
filehandle:write("Hello, World!") -- Write something
filehandle:close() Very important; this tells the computer that you're done with the file, and it doesn't need to keep it open anymore.
filehandle = io.open("saveddata", "r") -- Opens for reading
print(filehandle:read("*l")) -- Reads one line
filehandle:close()
i am trying to build an email system that sends messages between client computers and servers, i am using the file writing code you posted to save the email, so far it works but i cant figure out how to save the file to a specific folder. for example, the file will be saved in the folders "email/
recipient's computer number/ 'file name' "
how do i set it up so that it will save within the folders?
P.S.the recipients computer number folder will be named by a variable containing the number
EDIT: after a little more searching on the wiki i found the answer, this is how i fixed it.
fs.makeDir("email/"..to)
local filehandle = io.open("/email/"..to.."/test", "w")
filehandle:write(from.."\n")
filehandle:write(msg)
filehandle:close()
for this example the variable
to is equal to 1
fs.makeDir("email/"..to) creates the directories email/1/ (because to=1)
and local filehandle = io.open("/email/"..to.."/test", "w") tells io.open that the file is located in /email/1/ and is named test