[TC]Trek Posted August 21, 2013 Share Posted August 21, 2013 Hello, i would like to explode string into lines but i dont know how to do it. there is an example what i want function exampleFunction(someString) firstLine = getFirstLine(someString) secondLine = getSecondLine(someString) outputChatBox("Parsed string:") outputChatBox("- Line 1: "..firstLine) -- should print "Abcde_at_1_line" outputChatBox("- Line 2: "..secondLine) -- should print "StartOfSecondLine" end exampleFunction("Abcde_at_1_line\nStartOfSecondLine") can anyone help me please? Link to comment
./BlackBird# Posted August 21, 2013 Share Posted August 21, 2013 split function exampleFunction(someString) outputChatBox("Parsed string:") s = split(someString,"\n") for i,v in ipairs(s) do outputChatBox("- Line "..i..": "..v) end end exampleFunction("1\n2\n3\n4") tested it Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now