Find a character with a number

How can i make it so if there is a variable “testing”, if the input is “1” the output would be t and if input is “3” the output will be s. You guys know what i mean, how can i do it?

local var = "testing"

if your_input_method == "1" then
    var = "t"
elseif your_input_method == "3" then
    var = "s"
end
local yourString = "testing"

local input = 3

print(string.split(yourString,"")[input])

@anon_j1124 He wasn’t very clear with his request, I think this is what he means?

1 Like

no no no i dosent mean that, the variable is an unknown string

ohh right that will work, thanks

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