View previous topic :: View next topic |
Author |
Message |
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Thu Apr 19, 2018 10:55 am Post subject: Is it possible to add Lua functions through plugins? |
|
|
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 |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Thu Apr 19, 2018 11:01 am Post subject: |
|
|
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 |
|
|
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Thu Apr 19, 2018 12:28 pm Post subject: |
|
|
By adding these files to my project, will I have enough to do what I want?
_________________
... |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Thu Apr 19, 2018 1:29 pm Post subject: |
|
|
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 |
|
|
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Thu Apr 19, 2018 2:09 pm Post subject: |
|
|
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 |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Thu Apr 19, 2018 2:19 pm Post subject: |
|
|
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 |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Thu Apr 19, 2018 3:19 pm Post subject: |
|
|
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 |
|
|
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Thu Apr 19, 2018 8:26 pm Post subject: |
|
|
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 |
|
|
|