Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How I write a txt file on CE?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
makataurugami
How do I cheat?
Reputation: 0

Joined: 21 Apr 2017
Posts: 7

PostPosted: Fri May 10, 2019 2:13 pm    Post subject: How I write a txt file on CE? Reply with quote

I want to create a txt log that writes a value from a specific variable to the last line, as the time when i press the key F1 on keyboard.

Any Ideas?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat May 11, 2019 3:38 pm    Post subject: Reply with quote

You can use Lua's IO library to do this. Some links to the info regarding it:
https://www.lua.org/pil/contents.html#21

You'd want to use io.open with a write and append flag if you wish to add to the existing file and such.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat May 11, 2019 10:17 pm    Post subject: Reply with quote

Example:

Code:
-- To save / write
local f = assert(io.open("myvaluesave.txt", "w"))
f:write(your_firstVariable, "\n")
f:write(your_secondVariable, "\n")
f:write(your_thirdVariable, "\n")

--- and so on for all variables you wish
f:close()

-- To open / read
local f = assert(io.open("myvaluesave.txt", "r"))
your_firstVariable = f:read("*line")
your_secondVariable = f:read("*line")
your_thirdVariable = f:read("*line")

--- and so on for all or specific values
f:close()


The best way would be to put the variables inside a table and then use table serialize.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites