Jump to content




Parse Line to Words


  • You cannot reply to this topic
2 replies to this topic

#1 PixelFox

  • Members
  • 106 posts

Posted 28 July 2015 - 10:58 PM

I've been working on a function called "parse(_line)", but NOTHING I've done works.
Any suggestions?

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 28 July 2015 - 11:19 PM

I'm unsure of what you want, do you want a sentence separated into words?

local function parse( str )
  local t = {}
  for word in str:gmatch( "%S+" ) do
    t[ #t + 1 ] = word
  end
  return t
end


#3 PixelFox

  • Members
  • 106 posts

Posted 29 July 2015 - 12:13 AM

View PostKingofGamesYami, on 28 July 2015 - 11:19 PM, said:

I'm unsure of what you want, do you want a sentence separated into words?

local function parse( str )
  local t = {}
  for word in str:gmatch( "%S+" ) do
	t[ #t + 1 ] = word
  end
  return t
end
Thanks!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users