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

How to convert string to table?

Asked by 6 years ago

I'm making a LuaC engine, and it utilizes PCall, but I need the string converted to a table.

plr.Chatted:connect(function(msg)
        local function compile(...)
        local func,err = pcall(...)
        if (func) then
            sc("LuaC script executed",BrickColor.Green().Color)
        else
            sc(err,BrickColor.Red().Color)
        end
        end
        compile(msg)
end)

1 answer

Log in to vote
0
Answered by
Tomstah 401 Moderation Voter
6 years ago
Standard.ArrayToString = function(Array)
    local String = ""
    for i, v in ipairs(Array) do 
        String = String..tostring(v)
    end
    return String
end

Standard.StringToArray = function(String)
    local Array = {}
    for i = 1, String:len() do
        table.insert(Array, String:sub(i,i))
    end
    return Array
end

Since I already know what you're doing, here you go! You should see that it works fine.

Ad

Answer this question