-
-
Notifications
You must be signed in to change notification settings - Fork 427
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
feat(addCommand): longString #597
Conversation
imports/addCommand/server.lua
Outdated
elseif param.type == 'longString' and i == paramsNum then | ||
value = arg | ||
|
||
local argsNum = #args | ||
if paramsNum < argsNum then | ||
for a = i + 1, argsNum do | ||
value = value .. ' ' .. args[a] | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than concatenating the rest of the passed arguments, just take the raw string and trim off the other arguments. Same for the ts version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah I forgot we had a raw string
Raw string now used |
To clarify, there's no need to split the string into many parts and concatenate or join strings together. Just get the position of the last argument in the raw string and then make a substring from that point. |
Changed |
Whenever you have a command that has a text type at the end where you want to catch all text from that argument and on, only the first word will be assigned to that argument and the rest ends up all in an array which makes for a mixed table. With longString it catches those extras if the argument is at the end of the given params.
For example
/test test1 test2
Before only
test1
would be shown.After, all text will be shown.
I haven't tested this yet but ChatGPT said it will work fine