Add nil guards and verbose warnings for MyVehicleConfig across client modules#59
Add nil guards and verbose warnings for MyVehicleConfig across client modules#59
Conversation
Co-authored-by: Flohhhhh <48927090+Flohhhhh@users.noreply.github.com>
Co-authored-by: Flohhhhh <48927090+Flohhhhh@users.noreply.github.com>
Co-authored-by: Flohhhhh <48927090+Flohhhhh@users.noreply.github.com>
Flohhhhh
left a comment
There was a problem hiding this comment.
Looks good, but let's be slightly more verbose overall, for example i think we really should never be calling a lot of these things at all when MyVehicleConfig is nil
It would be nice to log some sort of warning in case we try to do something we shouldn't.
…icleConfig Co-authored-by: Flohhhhh <48927090+Flohhhhh@users.noreply.github.com>
Added verbose warning messages to all internal functions and event handlers that shouldn't be called when MyVehicleConfig is nil. Now functions like setBrakeExtras, setCruiseLights, onDoorStateChange, setReverseExtras, and others will log clear warnings if they're inappropriately called without a valid configuration. (commit 1f53b15) |
Co-authored-by: Flohhhhh <48927090+Flohhhhh@users.noreply.github.com>
When external
ulc.luafiles contain syntax errors, server-side loading fails andMyVehicleConfigremains nil, causing cascading client-side errors when attempting to access its properties.Changes
MyVehicleConfigproperties in all 9 client modules (buttons, stages, brake, horn, park, cruise, signals, doors, reverse)Example
Script continues running when configs fail to load instead of producing repeated uncaught errors. Warning messages help identify when functions are being called in invalid states, making debugging easier.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.