LuaParser: run Spring.TimeCheck's callback under unitsync/dedicated#3085
Merged
sprunk merged 1 commit intoJul 13, 2026
Merged
Conversation
Under UNITSYNC and DEDICATED, TimeCheck compiled to `return 0`, silently dropping the function it was handed. The shipped gamedata/defs.lua wraps all unitdef/weapondef/etc. loading in Spring.TimeCheck(...), so ProcessUnits() ends up with an empty root and throws "root unitdef table invalid" - unitsync reports zero units for every game whose defs.lua uses TimeCheck (the standard springcontent path). Only the profiling timer needs to be excluded from those builds, not the call itself.
sprunk
approved these changes
Jul 5, 2026
Contributor
Author
|
Oh there's other stuff but part of it is silly things like reading mod options or map options without checking first if those APIs exist I've worked around it for now by grabbing unit definitions via lua with shims and polyfills |
Collaborator
|
That's part of what I'm talking about though. Unitsync should probably define spGetModOptions and just have it return an empty table rather than requiring every game to sprinkle nil checks over their code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under
UNITSYNCandDEDICATED,TimeCheckcompiled toreturn 0, silently dropping the function it was handed. The shippedgamedata/defs.luawraps all unitdef/weapondef/etc. loading inSpring.TimeCheck(...), soProcessUnits()ends up with an empty root and throwsroot unitdef table invalid— unitsync reports zero units for every game whosedefs.luausesTimeCheck(i.e. the standard springcontent path). Only the profiling timer needs to be excluded from those builds, not the call itself.Surfaced by a lobby that enumerates units via unitsync; most consumers only read checksums/options, so it went unnoticed.
This also enables the callback under
DEDICATED— that seems correct (the function shouldn't discard its argument), but flagging in case that build skips it deliberately.