tests/pass/gmatch.lua

Wed, 24 Nov 2010 02:52:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 24 Nov 2010 02:52:37 +0000
changeset 138
f9bb0e212d28
parent 126
07ec490c7a6f
permissions
-rw-r--r--

Replace error reporting code with calls to LVM.traceback()

local i = 1;
local s = "the rain in spain stays mainly in the plain";
local st = { "the", "rain", "in", "spain", "stays", "mainly", "in", "the", "plain" };
for word in string.gmatch(s, "%a+") do
	print(word)
	assert(word == st[i], word.." == "..st[i]);
	i = i + 1;
end

assert(i == 10, i.." == 10");

mercurial