All pastes #338070 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-03 04:41 UTC
rendered paste body
# Make SURE there is no BOM in this file!  It causes functions to be seen as non-existent!

# This rebuilds the hazard list.
sub rebuildSpaceballs
{
	clear(@hazards);
	local('@data');
	$file1 = openf("botvgh/hazards/spaceballs.txt");
	@data = readAll($file1);
	closef($file1);
	for ($i = 0; $i < size(@data); $i++)
	{
		this('$line');
		$line = @data[$i];
		if (left("$line", 8) eq "COMMENT ")
		{
			removeAt(@data, $i);
			$i--;
		}
	}
	for ($i = 0; $i < size(@data); $i++)
	{
		# Little hackery: post-incrementing is a good thing.
		push(@hazards, %($hz => @data[$i++], $fx => @data[$i]));
	}
	return;
}

global('@hazards');
setProperty("client.encoding", "UTF-8");
rebuildSpaceballs();
echo(@hazards[0][$hz]);  #Err...how do I print out the first hz again?