-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lua inject]How to accomplish an async on a game thread #692
Comments
Isn't it obvious why you can't call |
The first piece of code give me a valid return value,However, this will cause some frame drops because it is not asynchronous A mechanism is needed to achieve something similar |
You obviously don't understand how variable scope and asynchronous programming works. |
I know why the return value is wrong. I'm just giving you an example, there are many ways to implement asynchronously, including coroutines and multithreading, etc., at present, UE4SS's Lua can't get blocking results at the end of asynchronous, on the other hand, unlua can complete asynchronous through coroutines, as I said in the title During the development of game mods, a lot of content is not suitable for running outside of the main thread of the game, and it only provides |
So, do you suggest I use code like this? Instead of allowing the next statement to wait for the result of the asynchronous execution, the code continuously determines whether a global variable has been modified to determine whether the asynchronous execution is complete You also mean suggesting that I use it for tail processing of callback functions |
I have a complex plan, I can complete them in the blueprint, then dump them during game runtime, and implement them by calling my own blueprint function through Lua,but this is quite complicated, and I don't like him |
I still have no idea what exactly you try to accomplish, but to come back to your original question of the issue: |
Thanks for the reply, here I have a question, I executed a |
Of course, I didn't do it to load assets, I just did some explosion calculations, but he seems to have affected the playback of the game's background music and caused the game to stutter |
I don't know how to lay out the lua environment for ue4ss and the coroutines don't seem to work
lua_pcall returned LUA_ERRRUN => attempt to yield across a C-call boundary
And
ExecuteAsync
is difficult to get the return value, and it is not safe to execute on the main thread of the gameThe text was updated successfully, but these errors were encountered: