function Categorizer(ceil, cat, fn)
	return 
		function(val)
			if(val >= ceil) then
				return cat;
			elseif( fn ~= nil ) then
				return fn(val);
			else
				return cat;
			end
		end
end

function hoyhoy(name, age)
	dbgPrint( "Name is " .. name );
	dbgPrint( "Age is " .. age );
	return "yahoo?";
end

function main()
	SizeCategory = Categorizer(40, "small");
	SizeCategory = Categorizer(60, "med", SizeCategory);
	SizeCategory = Categorizer(80, "big", SizeCategory);
	SizeCategory = Categorizer(90, "huge", SizeCategory);

	SpeedCategory = Categorizer(20, "walk");
	SpeedCategory = Categorizer(50, "run", SpeedCategory);
	SpeedCategory = Categorizer(70, "sprint", SpeedCategory);

	MoveAnimTable =
	{
		small = { walk = 1, run = 2, sprint = 3 }, 
		med = { walk = 4, run = 5, sprint = 6 },
		big = { walk = 7, run = 8, sprint = 9 },
		huge = { walk = 10, run = 11, sprint = 12 },
	};

	-- should print 2
	dbgPrint( MoveAnimTable[ SizeCategory(34) ][ SpeedCategory(57) ] );

	tbl = {zz = 11, 88, 77, 55, x = 73, y = "ssssss"};

	-- ret = GetTableAsParam(tbl, 2);
	-- dbgPrint( ret ); -- should be 22
	dbgPrint( tbl[2] ); -- should be "yy"
end

local b = Bah:new();
b:Set(88);
dbgPrint( b:Get() );
