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 do I open a table file with lua

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

Joined: 30 Sep 2021
Posts: 7

PostPosted: Tue Oct 12, 2021 3:31 pm    Post subject: How do I open a table file with lua Reply with quote

Hii , I want to add a .reg file with my trainer and make a lua so that if i press a button in the form, that .reg file will execute .Anyone know how to open table files do this?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater
Reputation: 5

Joined: 02 Sep 2011
Posts: 537
Location: 0x90

PostPosted: Tue Oct 12, 2021 3:41 pm    Post subject: Reply with quote

.reg = registry file. I suggest you change your extension; however, you can open a file like this:
Code:

shellExecute('path_to_file', 'open', 'SW_SHOWNORMAL')


Don't forget to escape backslashes i.e. instead of '\' use '\\'.
Back to top
View user's profile Send private message
DxKE
How do I cheat?
Reputation: 0

Joined: 30 Sep 2021
Posts: 7

PostPosted: Tue Oct 12, 2021 4:22 pm    Post subject: Reply with quote

LeFiXER wrote:
.reg = registry file. I suggest you change your extension; however, you can open a file like this:
Code:

shellExecute('path_to_file', 'open', 'SW_SHOWNORMAL')


Don't forget to escape backslashes i.e. instead of '\' use '\\'.


Thank you so much, if I add the file in cheat engine table what would be the path?

For example, we can use playSound(findTableFile('sound.wav'))
is there anylike like this for other file type?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater
Reputation: 5

Joined: 02 Sep 2011
Posts: 537
Location: 0x90

PostPosted: Tue Oct 12, 2021 4:43 pm    Post subject: Reply with quote

You can use TrainerOrigin which sets a variable that contains the path of the trainer that launched Cheat Engine (Only set when launched as a trainer)
Code:

local path = TrainerOrigin


Other functions should you need them:
Code:

getFileList(Path:string, searchMask:string OPTIONAL, SearchSubDirs: boolean OPTIONAL, DirAttrib: integer OPTIONAL): Returns an indexed table with filenames
getDirectoryList(Path:string, SearchSubDirs: boolean OPTIONAL): Returns an indexed table with directory names
extractFileName(filepath): Returns the filename of the path
extractFileExt(filepath): Returns the file extension of the path
extractFileNameWithoutExt(filepath): Returns the filename of the path, without the extension
extractFilePath(filepath): Removes the filename from the path
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