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 


Is it possible to add Lua functions through plugins?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Thu Apr 19, 2018 10:55 am    Post subject: Is it possible to add Lua functions through plugins? Reply with quote

For a certain hack, I need to run functions in C ++.
So I wanted to know if using plugins I can add C ++ functions to Lua.

_________________
...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Apr 19, 2018 11:01 am    Post subject: Reply with quote

yes, plugins can use lua (just use the GetLuaState function call in the exportlist to get the lua state)

and from there you can call lua_register to link to c++ wrappers that call the c++ functions

When building your dll do make sure your plugin links to the modified dll names (lua53-32.dll and lua53-64.dll). Easiest is using the .lib files here https://github.com/cheat-engine/cheat-engine/tree/master/Cheat%20Engine/plugin

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Thu Apr 19, 2018 12:28 pm    Post subject: Reply with quote

By adding these files to my project, will I have enough to do what I want?
_________________
...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Apr 19, 2018 1:29 pm    Post subject: Reply with quote

don't forget to include the header file as well, but yes
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Thu Apr 19, 2018 2:09 pm    Post subject: Reply with quote

After so much trying, I came to a conclusion.
Either these functions are not in the .lib file
Or they have different names.

_________________
...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Apr 19, 2018 2:19 pm    Post subject: Reply with quote

You need to set the linker paths as well

and what functionnames are you using ?

And try building for 64-bit instead of 32-bit

yeah, 32-bit is bitchy, instead of static linking try dynamic linking using loadlibrary and getprocaddress

edit2: Actually, it may be some compiling param issues

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Apr 19, 2018 3:19 pm    Post subject: Reply with quote

https://github.com/cheat-engine/cheat-engine/tree/master/Cheat%20Engine/plugin has some new .lib files you can use

also the example-c project now uses lua as well to register the 'pluginExample()' function (and it compiles and runs last time I checked)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Thu Apr 19, 2018 8:26 pm    Post subject: Reply with quote

After compiling it, an error occurred while starting the plugin.
I was able to finally do, the problem is that I was using GetLuaState as a variable and not a function.
I thought this because the GetLuaState declaration is "VOID * GetLuaState;" and not "VOID (* GetLuaState) ();"

_________________
...
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 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