For tokenizing a string, standard Lua recommends to use regexes. The followinf example splits words: for i in string.gmatch(example, "%S+") do print(i) end This is a little bit overkill for simply split words. This patch adds a tokenize function which quick and do not use regexes.