Hello Guest

Writing text to a file and loading data from that file

  • 1 Replies
  • 29 Views
*

Keiichi4444

  • *
  • 1
  • +0/-0
    • View Profile
Writing text to a file and loading data from that file
« on: November 29, 2018, 01:55:19 am »
Hi all!

Can someone help me with function to use a separate file (i.e. dicelog.txt) to put some text there like i do it with "print" command and save it.
And if that's possible, can i somehow open that file take some info to var's in the working script?

i.e.

logfile = loadfile('dicelog.txt')
logfile:write(basebet = 0.00000010)
nextbet = logfile:read(basebet)
logfile:close()

Or smth like that) I just took this commands from my head, to show what i want to do.

Will appreciate ur help.

Ty.

*

Seuntjie

  • *****
  • 138
  • +0/-1
    • View Profile
Re: Writing text to a file and loading data from that file
« Reply #1 on: November 29, 2018, 08:10:52 am »
You can look into http://lua-users.org/wiki/IoLibraryTutorial

Why do you need to save variables to a text file though?