| View previous topic :: View next topic |
| Author |
Message |
Game Hacking Dojo Master Cheater
Reputation: 1
Joined: 17 Sep 2023 Posts: 250
|
Posted: Mon May 06, 2024 5:48 am Post subject: Running Functions in a New Thread |
|
|
I have functions to execute using the MainForm however those functions are run in the main thread. I want the functions to be run in a new thread execute and terminate the created thread since I read in the documentation, it has to be terminated manually.
So I was thinking this could be the solution:
| Code: | StringsBtn.OnClick = createThread(function ()
pcall(createRefrencedFile,"s")
end) |
Of course, it didn't work. So, as far as I know, I should use createThread at the call of the function and in this case, it's the button that calls the function.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25813 Location: The netherlands
|
Posted: Mon May 06, 2024 6:03 am Post subject: |
|
|
| Code: |
StringsBtn.OnClick = function()
createThread(function ()
pcall(createRefrencedFile,"s")
end
end)
|
_________________
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 |
|
 |
Game Hacking Dojo Master Cheater
Reputation: 1
Joined: 17 Sep 2023 Posts: 250
|
Posted: Mon May 06, 2024 6:10 am Post subject: |
|
|
| Dark Byte wrote: | | Code: |
StringsBtn.OnClick = function()
createThread(function ()
pcall(createRefrencedFile,"s")
end
end)
|
|
This doesn't compile.
While this compiles:
| Code: | StringsBtn.OnClick =
createThread(function ()
pcall(createRefrencedFile,"s")
end) |
This one makes it sometimes run the code even if I didn't call it, just by launching CE. And when it's clicked (called) it doesn't do anything.
Okay found it thank you. it was a bracket issue found )
Correct code:
| Code: | StringsBtn.OnClick = function()
createThread(function ()
pcall(createRefrencedFile,"s")
end)
end |
|
|
| Back to top |
|
 |
|