All pastes #339457 Raw Edit

Someone

public text v1 · immutable
·published 2007-02-04 02:22 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 = $i + 2)
	{
		this('%haz');
		%haz = %(hz => @data[$i], fx => @data[($i + 1)]);
		push(@hazards, %haz);
		#push(@hazards, @(@data[$i], @data[($i + 1)]));
	}
	return;
}

global('@hazards');
setProperty("client.encoding", "UTF-8");
rebuildSpaceballs();
#%temp = @hazards[1];
#echo(%temp["hz"]); #These two lines work together (this and above).
echo(@hazards[1].%haz["hz"]);  # This line by itself isn't working.
#echo(@hazards[1][0]);