Simplify the purpose of PostCommandCalled - #87
Merged
zpetty33 merged 1 commit intoSep 14, 2022
Merged
Conversation
zpetty33
added a commit
that referenced
this pull request
Aug 24, 2025
* Migrate UCL user store from flat file to SQLite. (#74) * feat: add db creation and user saving * fix: change protected term (group) to usergroup * fix: sqlstr only escapes single quotes * feat: load the users. * chore: thonk? * fix: when adding a user, only save once. * feat: make userInfo opt * feat: function to delete a stored user. * feat: save for the remainder of operations * fix: only try loading from the db if we've not just created it. * fix: switch to json for an odd sqlite saving error * feat: properly migrate. * fix: we should be using the same noMount setting for both read and existance? * fix(comment): Minor fix for the comment. * fix: make that local, since we're not calling it for testing now. * fix: remove the old file write, no longer required. * feat: add function to delete all stored db users. * feat: allow db data to be checked on load. * Merge Master branch updates into Experimental Branch (#84) * Update CHANGELOG.md * Fix Weapon SetClipErrors (#76) * fix: result isn't used in this context. * fix: the docs say ply, we use ply. * perf: we don't need to call that twice. * fix: printname isn't a name, it's class. localise class. * fix: fix weapon error if not given. replace printname with class. only call getweapon if we can't get it through give. * fix: Make sure SetClip1 and SetClip2 actually exist before we call them. * WTF (#63) * Update CHANGELOG.md * Update ulib.build * Update addon.txt * Update defines.lua Co-authored-by: Joshua Piper <32164094+JoshPiper@users.noreply.github.com> Co-authored-by: Deyvan <51455765+Deyvan@users.noreply.github.com> * Add ULibPostCommandCalled (#80) * Add hook for post command called * Document the hide param * Change tenses in defines * Update versions * Fix version numbers * Simplify the purpose of PostCommandCalled (#87) --------- Co-authored-by: Joshua Piper <32164094+JoshPiper@users.noreply.github.com> Co-authored-by: Deyvan <51455765+Deyvan@users.noreply.github.com> Co-authored-by: Brandon Sturgeon <brandon@brandonsturgeon.com>
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.
Context
In my original PR, I implemented a whole new hook (
ULibPostCommandCalled) that was supposed to only be called if a command successfully ran.My original PR was bad - it simply didn't work correctly.
This PR aims to rectify that mistake with a simpler and more targeted approach.
Description
ULibPostCommandCalledhookULibPostCommandTranslatedhook (thecallResultof the command function)This PR adds a fourth parameter to the
ULibPostCommandTranslatedhook. This parameter is just the result of calling the base command function.This will allow command functions to, for example,
return falseif they failed for some reason. This was my primary focus - I wanted to know if a ULX command actually successfully performed the action. However, this also opens to door to any kind of pre -> post command interaction.Maybe some developers would like to return a table with additional information about what happened in the command.
It's a very flexible change, and the more creative uses of this change probably exceed the limits of my imagination at present :)
More Info
I've also created a Draft PR to the ULX project that demonstrates how this could be used.
With that ULX change, developers could check for the fourth parameter to
ULibPostTranslatedCommandhook to see if the function actually ran successfully. This is the bare-minimum functionality this PR could provide.