How to stop string.split()?

  1. What do you want to achieve? Keep it simple and clear!

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Hello developers! Since you see the title. I wonder. Here is the script so far.

local MyString = "This is a test."
MyString:split(" ")
print(MyString[1)
---- Ok now I want it stop split. I don't know what to do.

Thank’s for reading!

What do you mean by “stop split?”

Like you split message when you print it out, It gonna show index[1].
Now I want print it fully. But it won’t since I split it.

You can just do

print(table.unpack(splitTable))
1 Like

Just print the original string?

1 Like

Another option is storing the original string in one variable and the split string in another.

local MyString = "This is a test."
local SplitString = MyString:split(" ")

print(SplitString[1]) -- Outputs "This"
print(MyString) -- Outputs "This is a test."

I’m trying to make admin system something like: (:Kick) (User) (Reason).
I split the string so it print out reason with limit. That’s why I want to remove split.