-
Notifications
You must be signed in to change notification settings - Fork 102
Description
This is a case of a typo + a footgun.
show_outfit_on_use.lua :: pace.OnUseOnlyUpdates() does this: pace.Call("OnUseOnlyUpdates", ...)
pac3/lua/pac3/editor/client/show_outfit_on_use.lua
Lines 74 to 76 in ad24088
| function pace.OnUseOnlyUpdates(cvar, ...) | |
| pace.Call("OnUseOnlyUpdates", ...) | |
| end |
and then editor/client/init.lua :: pace.Call() prefixes that "OnUseOnlyUpdates" with "On" and then tries to call nonexistent hook "OnOnUseOnlyUpdates", resulting in the actual hook failing to run and the user getting a scary Lua error popup. This is a pretty bad look for simply toggling the most popular pac user preference.
pac3/lua/pac3/editor/client/init.lua
Lines 298 to 306 in ad24088
| function pace.Call(str, ...) | |
| if pace["On" .. str] then | |
| if hook.Run("pace_On" .. str, ...) ~= false then | |
| return pace["On" .. str](...) | |
| end | |
| else | |
| ErrorNoHalt("missing function pace.On" .. str .. "!\n") | |
| end | |
| end |
In addition to fixing this, I recommend fixing pac's footgun of prefixing of hook names like this and requiring the caller to omit the known prefix.