Function DeleteScreen

DeleteScreen(name)
The function should be used after a screen remembered using SaveScreen is no longer needed to free up memory. This could be useful, for example, when implementing Undo/Redo functionality:
$undoSteps = 0
$thisStep = 0

function OnMouseUp(x, y)
	DrawCircle(x, y, 5)
	$thisStep = $thisStep+1
	for i=$thisStep to $undoSteps
		DeleteScreen(i)
	next
	$undoSteps = $thisStep
	Redraw()
	SaveScreen($thisStep)
end function

function Undo()
	if $thisStep > 0
		$thisStep = $thisStep - 1
		restoreScreen($thisStep)
	end if
end function

function Redo()
	if $thisStep < $undoSteps
		$thisStep = $thisStep + 1
		restoreScreen($thisStep)
	end if
end function

function OnKeyboard(c)
	if c = "VK_LEFT"
		Undo()
	elseif c = "VK_RIGHT"
		Redo()
	end if
end function

SaveScreen(0)

See also: