tests/pass/upvalue.lua

Sat, 21 Sep 2013 14:31:22 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 21 Sep 2013 14:31:22 +0100
changeset 143
a689e0187ef5
parent 126
07ec490c7a6f
permissions
-rw-r--r--

Fix math.frexp() and add more tests (thanks Florob, Link Mauve, xnyhps)

local u;
local f = {};
for i=1,2 do
	f[i] = function (set)
		if set then
			u = set;
		end
		return u;
	end;
end

assert(f[1]("foo") == "foo");
assert(f[2]() == "foo");

assert(f[2]("bar") == "bar");
assert(f[1]() == "bar");

mercurial