Jump to content




How to save variables?


  • You cannot reply to this topic
1 reply to this topic

#1 Klausar

  • Members
  • 110 posts

Posted 20 October 2012 - 01:35 PM

Hey CC-Community,
I want to make a more advanced program. For this I need to save variables if that is possible. For example: I want to register a name at the first startup of the program, I would make

x = io.read()

but how can I make it so that the x always stays the same? Is that possible? Thanks for your help :)/>

#2 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 20 October 2012 - 01:50 PM

You could store its value to a file.
Advert made a nice API for storing data: http://www.computerc...save-your-datas

It takes away the need to know how to do IO-Operations on files yourself.
Or did you explicitly want to know how to do it yourself? In that case I'd suggest looking into the fs api.
Type "help fs" in ComputerCraft, or look into the wiki: http://computercraft...?title=Fs_(API)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users