How can I get first and second variable of a TextBox's text?

Hello! I am making a developer console and I am simply curious, how could I detect a TextBox’s first and second variable?

For example:

image

You don’t have to give me full code, obviously. Just an example or a brief explanation should do, thank you!

I believe this can be achieved by using string.split().

Simply put the string in the first parameter, and in the second parameter, you wanna put something that you want the strings to split, in this case, spaces. For example:

local Input = "print hey"

local Words = string.split(Input, " ") --Will return a table of split strings.

print(Words)
3 Likes

Ohh I see now, string.split works and everything is working as intended. Thank you!

1 Like

Adding on from @SionixKev post, you can also use the string.find() function, where the first parameter is the string you want to search and the second parameter is the keyword you want to find.

For example:

if string.find("HelloWorld!", "World") then
   print("Found 'World' in the string!")
end

This may come in handy in this situation.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.