Skip to content

Tolerate unparseable mod payloads in load_payloads()#31

Open
bradyccox wants to merge 1 commit into
dcs-retribution:retributionfrom
bradyccox:fix/load-payloads-valueerror-tolerance
Open

Tolerate unparseable mod payloads in load_payloads()#31
bradyccox wants to merge 1 commit into
dcs-retribution:retributionfrom
bradyccox:fix/load-payloads-valueerror-tolerance

Conversation

@bradyccox

Copy link
Copy Markdown

Problem

FlyingType.load_payloads() catches SyntaxError but lets ValueError propagate. Some third-party mod payload Lua files (e.g. the CJS Super Hornet v2.4) use local variable names as table indices ([OBL], [JML], …), which the Lua parser can't represent — lua.loads() raises ValueError ("could not convert string to float: ''"). A single such file currently aborts payload loading for every aircraft in the install.

Fix

Skip the offending file with a warning, mirroring the existing SyntaxError-tolerant path, so one malformed mod payload no longer breaks loadouts for the whole install.

except ValueError:
    logging.getLogger("pydcs").warning(
        "Skipping payload file with unsupported Lua syntax: %s", payload_path
    )
    continue

Verified that lua.loads() raises exactly ValueError on local-variable table indices.

🤖 Generated with Claude Code

load_payloads() catches SyntaxError but lets ValueError propagate. Some
third-party mod payload Lua files (e.g. the CJS Super Hornet v2.4) use local
variable names as table indices, which the Lua parser cannot represent and
reports as a ValueError. A single such file currently aborts payload loading
for every aircraft.

Skip the offending file with a warning, matching the existing
SyntaxError-tolerant behavior, so one malformed mod payload no longer breaks
loadouts for the whole install.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant