Jump to content

New outputChatBox at every point


Gordon_G

Recommended Posts

local example = "an example string . an other ."
sentences_ = {}
sentence = ""
for i in string.gmatch(example, "%S+") do -- This string.gmatch cut the string at every word
   sentence = sentence.." "..i
   if i == "." then -- Cut the string at the point and insert it into a table
   table.insert(sentences_,sentence)
   sentence = ""
   end
end


for k,v in ipairs(sentences_) do
print(v)
end

I did it myself with the help of : http://lua-users.org/wiki/SplitJoin

But it's not really optimized, any other way ?

 

Edit : Sorry for the double post, I can't edit anymore the firt.

Edited by Gordon_G
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...