Quick one. I'm wondering what an equivalent for io:read() in Roblox is, for multi-line strings not files like in regular Lua.
Script:
function Read_PPM(Text)
local data = Text:read("*line")
if data ~= "P6" then
return nil
end
repeat
data = Text:read("*line")
until string.find(data, "#") == nil
local image = {}
local size_x, size_y
size_x = string.match(data, "%d+")
size_y = string.match(data, "%s%d+")
data = Text:read("*line")
if tonumber(data) ~= 255 then return nil end
for i = 1, size_x do
image[i] = {}
end
for j = 1, size_y do
for i = 1, size_x do
image[i][j] = {string.byte(Text:read(1)), string.byte(Text:read(1)), string.byte(Text:read(1))}
end
end
return image
end

1 comment
You could split the multi-line string by each new line "\n" and then loop through the table to get each line.