Skip to content
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

Fix assert on startup when calling back on an empty string #5717

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

JonBooth78
Copy link
Contributor

Fixes #5716

@Max5377
Copy link
Contributor

Max5377 commented Jan 18, 2024

The question is, why module_name is empty in the first place when it should normally return lua module name?

@Web-eWorks
Copy link
Member

The module name is empty because LuaConsole.cpp is directly calling Event.Register(...) and the calling module context requested from Event.Register is a C function which has no valid filepath and therefore cannot be translated into a module name.

This technically exposes a flaw in the new Event system where C++ can only register one Lua callback handler for each event type without overwriting the previously-set handler. That's not a problem in practice (as generally speaking a C++ function shouldn't be listening for a Lua event but rather use a sigc::signal instead), but something I'll have to keep in mind for the future.

@Web-eWorks Web-eWorks merged commit a2170e9 into pioneerspacesim:master Jan 19, 2024
6 checks passed
@JonBooth78 JonBooth78 deleted the fix-assert-on-game-load branch February 3, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Assertion failed!" when the game is loading
3 participants