Discard.view

From AGI Wiki
Jump to navigationJump to search

The discard.view command unloads a view resource from the memory heap.

Syntax

discard.view(byt A);

Remarks

This command takes a number as the argument. View A is unloaded from memory.

The discard.view.v command also unloads views, but takes a variable as the argument.

AGI adds a script entry to the script stack each time a view resource is unloaded.

Possible Errors

Before unloading a view, make certain it is not in use by any active screen objects. If a view is unloaded while still assigned to an object, AGI will most likely crash.

Because of the way that AGI manages memory on the heap, resources must be unloaded in reverse order of the way they were originally loaded, or unexpected results may occur.

Attempting to discard a resource that has not been loaded will raise trappable error #1.

Example

Code:
load.view(8) [ load view 8
...
[ do something with it
...
[ make sure view 8 is no longer used before unloading
discard.view(8);

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 32 (0x20 hex)

See Also

Screen Object/View Commands
discard.view.v
load.view
load.view.v
set.view
set.view.v