Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is there a possible way of converting strings?

Asked by 5 years ago
form(plr, pl, ctr)

yes probably the shortest piece of code you've ever seen but form is a string and all im asking is if there is a way to remove the quotes around form so it's not a string. ex. "lol" = lol i need to convert it.

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

I'm not exactly sure what you're trying to do here, as neither the title or the description is that informative, so I'm assuming that "form" is a string and you are trying to use it as a function.

commonly i like to use tables for this purpose, specifically dictionaries.

As dictionaries have string keys, it is actually pretty straightforward. You can simply index the dictionary with the string and input parameters like such:

local tbls = {
    foo = function (q,w,e)
        print(q,w,e)
    end
}

Event.Event:Connect(function(command,ree,ko,ef)--"foo","jack","jill","dead meme"
    print(command)--foo
    tbls[command](ree,ko,ef)
end)
Ad

Answer this question