-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feature Request:Implement a LuaAPI.force_stop
method
#186
Comments
LuaAPI.force_stop
method
Handling shutdown is on the game. You dont need any lua side code to do this. You just keep track of all states and do whats required to make them stop gracefully. IE using a hook if you need to force the state to stop or otherwise telling the script to stop. This library helps a lot but state management is out of scope of what I am aiming to do. EDIT: |
This wont work for when callables are properly implemented as they will have callables hooked up to it and those callables will have a reference. |
Anyways to properly fix this there will be needed a modification to what is gonna be inside the callablecustom, for example when the luaAPI has called |
This is inaccurate. It was when the comment was made but I was waiting on changes to be made to the GDExtension side of CallableCustoms that made storing the reference of the object no longer required. So when #180 is merged all we will store is the ObjectID and not the Object its self. |
You can also utilize the lua garbage collector with the methods we have exposed for that in order to purge references from with the lua state. |
Is your feature request related to a problem? Please describe.
What if the game just wants to stop everything? It cant just know what was bound or not using signals can it? This is where this method would come into play.
Describe the solution you'd like
To efficiently shut down everything, all that would be needed to do is to clear the global table and register table and let the garbage collector do its thing. If there are reference cycles (which would be something very possible), an even better way would be to track what coroutines exist somewhere and then to close them all. If possible, this could be substituted with the
lua_closestate
to do it all.Describe alternatives you've considered
Having to do it manually from a protected environment. This would mean running some lua code to initialize the API with the debug library active to allow that code to lock everything down and then to run the said code inside the now protected environment. On a shutdown call, it would do exactly as described before. This would also mean that
coroutine.create
andcoroutine.wrap
would require modification to track them somewhere.The text was updated successfully, but these errors were encountered: