There is already a thread here, even it’s not very detailed:
Actually this thread is about Megus’s Routing library so maybe this discussion would be better off its own thread (in the Defoldmine) or moved to the one cited above.
There is already a thread here, even it’s not very detailed:
Actually this thread is about Megus’s Routing library so maybe this discussion would be better off its own thread (in the Defoldmine) or moved to the one cited above.
I am currently having a problem with this routing library. I set up my routing table with only the first scene, and then used push
to push another scene.
The problem occurs when I call close
on the pushed scene, The previous (first) scene shows up and works fine, but I get an error in the debug console:
ERROR:SCRIPT: wh_router/router.lua:64: attempt to call a nil value
stack traceback:
wh_router/router.lua:64: in function 'next_scene'
wh_router/router.lua:165: in function 'on_message'
main/loader.script:27: in function <main/loader.script:24>
Any help ?
Nevermind, found the answer, I was firing the close
twice
Hello everyone! I’ve fixed an issue with the library which could cause crashes when you have big navigation stack or pass complex inputs/outputs/states. Thanks to @AGulev for identifying this! The change doesn’t affect existing code so you can safely update and continue to use it.
I think there is still room for optimizing this, I’ll look into it later. Also another set of updates is coming soon.
Hello everyone! I wonder if anyone actually uses my library in their projects? I’m planning a big update in the nearest couple of weeks and deciding whether to keep it backwards compatible because the updates may not fit good with the existing API. Also, I’m open to feature requests All the previously mentioned planned improvements will be included in this update.
Begin to publish versions on github and encourage people to use versioned numbers in their lib includes (everyone should be doing this).
I have it included in a few projects but can live with making changes for the better.
I’ve published the new version of my library and changed its name to whDefRouter.
The new features include:
The API is the same, but there are some new messages for transitions and “Loading.” The routing table format is changed, but it will be easy to convert. Check out the documentation on GitHub or at the Community Page: https://www.defold.com/community/projects/46206/
If you use my library in your project, try to update and let me know of any issues. I’m ready to help anyone
Hello, as a newbie this library is helping me a lot, but I wonder how to reload the current scene?
I try to push the current scene but it will fail due to the scene already loaded.
Thanks.
Edit: I already solve my problem by making a function to reload the stage in my scene
I think I’ve seen similar requests several times already. I’ll add this to my backlog, maybe I can come up with some nice solution. I usually do it the same way you did it — re-initialize a level inside the loaded scene.
Hi, i was using your old asset and now when i updated and got the latest, the routing doesnt work any more… is it a lot i have to change to make it work again? can i use the old version still and if i can, how do i do that?
There are no releases on the GitHub page: https://github.com/Megus/defold-router @megus.sugem you really should create releases as it becomes a whole lot easier to lock down a specific version of the lib in your game.project file.
You can still lock down a specific version though:
Yes, my bad that I didn’t create a version tags. Well, I asked if people are fine with the new version not compatible with the previous one and they said OK
Hello. Yes, the new version is slightly not compatible with the previous one, but the fix is pretty simple.
The main change is the routing table. It was extended to support new features of the router. So, you currently have something like this:
local M = {}
function M.first_scene()
return "main_menu" -- Change to the name of your first scene
end
function M.main_menu()
return "game"
end
return M
Convert it to the following format:
local M = {
info = {},
first_scene = "main_menu",
routing = {
main_menu = function()
return "game"
end
}
}
return M
After this change the router should work for you again. Check out the documentation on GitHub on how to use the new features: animated transitions, sync/async loading of scenes and “Loading…” popup.
If you still have issues, let me know so I can help you.
Sorry for the inconvenience. I tried to make the new version as much compatible, but had to do this change.