-
Notifications
You must be signed in to change notification settings - Fork 194
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
Improvements to console hook related functions based on issue #653 #669
Conversation
feat: Use explode_by_occurrence_with_quotes intsead of explode_by_occurrence in RegisterProcessConsoleExecCallback
…uotes in all ProcessConsoleExec functions docs: Add better examples for RegisterProcessConsoleExecPreHook and RegisterProcessConsoleExecPostHook
…tHook, RegisterConsoleCommandHandler and RegisterConsoleCommandGlobalHandler to pass only the command name as first callback parameter
…mand name feat: In RegisterProcessConsoleExecPreHook and RegisterProcessConsoleExecPostHook the callback parameter CommandParts should contain all seperated parts of the command, the "command name" as well
…mandGlobalHandler, RegisterConsoleCommandHandler, RegisterProcessConsoleExecPreHook and RegisterProcessConsoleExecPostHook
…nsoleExecPostHook examples futher to show how to get command name
The function New test results Output:
Current behavior if there is no closing quotation markCommand:
|
Since we have no Unit tests, I just wrote some code that I put into the auto split = explode_by_occurrence_with_quotes(StringType(STR("")), STR(' '));
assert(split.empty());
split = explode_by_occurrence_with_quotes(StringType(STR(" ")));
assert(split.empty());
split = explode_by_occurrence_with_quotes(StringType(STR(" ")), STR('_'));
assert(split.size() == 1);
assert(split[0] == StringType(STR(" ")));
split = explode_by_occurrence_with_quotes(StringType(STR("test")), STR(' '));
assert(split.size() == 1);
assert(split[0] == StringType(STR("test")));
split = explode_by_occurrence_with_quotes(StringType(STR("test_param1_\"param 2\"_param 3")), STR('_'));
assert(split.size() == 4);
assert(split[0] == StringType(STR("test")));
assert(split[1] == StringType(STR("param1")));
assert(split[2] == StringType(STR("param 2")));
assert(split[3] == StringType(STR("param 3")));
split = explode_by_occurrence_with_quotes(
StringType(STR("\\\"command param1\" \"Param 2 has \\\" in the middle\" \"Param 3 goes till the end")));
assert(split.size() == 4);
assert(split[0] == StringType(STR("\"command")));
assert(split[1] == StringType(STR("param1\"")));
assert(split[2] == StringType(STR("Param 2 has \" in the middle")));
assert(split[3] == StringType(STR("Param 3 goes till the end"))); |
…` `(space) docs: Add function documentation to explode_by_occurrence_with_quotes docs: Add changes to Changelog.md
I haven't been able to find any problem with the code just by looking at it, but I'm unable to test it. |
If you mean the “unit tests” aka. asserts, they have run through without errors. |
Description
explode_by_occurrence_with_quotes
(feel free to suggest a better name)\
, which allows the use of double quotation marks in the text (\"
)explode_by_occurrence
usage withexplode_by_occurrence_with_quotes
in functions:Unreal::Hook::RegisterProcessConsoleExecGlobalPreCallback
Unreal::Hook::RegisterProcessConsoleExecGlobalPostCallback
Unreal::Hook::RegisterProcessConsoleExecCallback
(both forRegisterConsoleCommandHandler
andRegisterConsoleCommandGlobalHandler
)RegisterConsoleCommandGlobalHandler
,RegisterConsoleCommandHandler
,RegisterProcessConsoleExecPreHook
andRegisterProcessConsoleExecPostHook
1
Resolves #653
Type of change
How Has This Been Tested?
With this Lua code + attached VS debugger to the game while executing the console command
CommandExample param1 "param 2" 3
:Checklist
explode_by_occurrence_with_quotes
codeexplode_by_occurrence_with_quotes