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

Misleading log message: Failed to load: X.lua (no GetInfo() call) #3023

Open
MasterBel2 opened this issue May 16, 2024 · 1 comment
Open

Comments

@MasterBel2
Copy link
Contributor

While an edge case, providing a lua script with no widget:GetInfo() allows for modifying game behaviour in a predictable way; files without a widget:GetInfo() are executed and can modify the LuaUI environment, though they cannot be disabled; this throws a misleading Failed to load XXX.lua message when in fact the file has indeed been executed.

No game-supplied widgets make use of this loophole to modify game state, although a few display it by gating their code (including widget:GetInfo()) behind some check, e.g. for a mod option. Such files are shown below:

[t=00:04:44.049029][f=-000001] Failed to load: __defs_write.lua  (no GetInfo() call)
[t=00:04:44.388663][f=-000001] Failed to load: gui_unit_market.lua  (no GetInfo() call)
[t=00:04:44.347048][f=-000001] Failed to load: gui_scavenger_info.lua  (no GetInfo() call)
[t=00:04:44.060007][f=-000001] Failed to load: autocheat.lua  (no GetInfo() call)

I use this to modify the widget environment (e.g. extending table, string etc) before any widget:Initialize() is run (arguably a less than ideal solution), and the successful operation of such files highlights the misleading nature of calling file loading a failure.

@salinecitrine
Copy link
Collaborator

What kind of solution would you recommend for this? Is the issue more that the log message doesn't communicate clearly, or that it's possible for widgets to run code before being officially "loaded"? The log message seems easy to change; widgets being able to modify the environment sounds very tricky to change.

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

No branches or pull requests

2 participants