Discard.view.v

From AGI Wiki
Jump to navigationJump to search

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

Syntax

discard.view.v(var vA);

Remarks

This command takes a variable as the argument. View vA is unloaded from memory.

Use the discard.view to unload views by number.

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

Possible Errors

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.

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.

Example

Code:

<syntaxhighlight lang="agi"> load.view(8) [ load view 8 ... [ do something with it ... [ make sure view 8 is no longer used before unloading v52 = 8; discard.view.v(v52); </syntaxhighlight>

Technical Information

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

See Also

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