Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to convert string to table?

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

✓ Accepted answer
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.

This discussion is preserved as it was. New answers, comments, and votes are closed.