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

How to split an texts to a table?

Asked by 3 years ago
Edited 3 years ago

e.g "Hello!" > {"H", "e", "l", "l", "o", "!"}. I will appreciate if someone found an solution, i don't put my script cause i just ask how to split texts.

0
That's pretty easy. Wait, I make an Answer for you. Ferrarimami 120 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
local UnTabledText = "STRING HERE"
local TableName = {}
local LengthOfText = #UnTabledText
for i = 1, LengthOfText do
    local SubString = string.sub(UnTabledText, i, i)
    table.insert(TableName, SubString)
end
-- for i, v in pairs(TableName) do
    -- print(v)
-- end -- Thisis just to print the Table, not required.

Explanation: Replace STRING HERE with any string you want/any string variable. If you got more questions, ask, please.

0
Thanks a lot! azakmi_uui2 60 — 3y
0
No problem! Ferrarimami 120 — 3y
Ad

Answer this question