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

How to detect each line of a string? (SOLVED -by me-)

Asked by 4 years ago
Edited 4 years ago

Working Code:

function GetLine(text)
    local words = {}
    local word = ""
    for i = 1, #text do
        local char = string.sub(text,i,i)
        if char ~= "\n" then 
            word = word..char
        else
            table.insert(words,#words+1,word)
            word = ""
        end
    end
    return words
end

Returns a full table so yeah lol.

1 answer

Log in to vote
0
Answered by
goodlead -62
4 years ago

Hello sir, here is a helpful resource to refer to

https://www.lua.org/manual/5.1/index.html#contents

0
Plese copy and paste the link... goodlead -62 — 4y
Ad

Answer this question