Difference between revisions of "Discard.view"
(14 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | The '''discard.view''' command | + | The '''discard.view''' command unloads a [[view]] resource from the [[memory heap]]. |
− | + | == Syntax == | |
− | + | discard.view([[number|byt]] A); | |
− | == | + | == Remarks == |
− | + | This command takes a number as the argument. [[View]] '''A''' is unloaded from [[memory heap|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 [[memory heap|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 == |
− | + | <div class="CodeBlockHeader">Code:</div> | |
+ | <syntaxhighlight lang="agi"> | ||
+ | load.view(8) [ load view 8 | ||
+ | ... | ||
+ | [ do something with it | ||
+ | ... | ||
+ | [ make sure view 8 is no longer used before unloading | ||
+ | discard.view(8); | ||
+ | </syntaxhighlight> | ||
− | + | == Technical Information == | |
− | |||
− | + | {| border="1" cellpadding="2" | |
+ | | style="background-color: #efefef" width="200" | '''Required Interpreter Version:''' | ||
+ | | width="175" | Available in all AGI versions. | ||
+ | |- | ||
+ | | style="background-color: #efefef" | '''Byte-Code Value:''' | ||
+ | | 32 (0x20 hex) | ||
+ | |} | ||
− | + | == See Also == | |
− | |||
− | |||
− | + | [[Screen Object/View Commands]]<br /> | |
− | + | '''[[discard.view.v]]'''<br /> | |
− | + | '''[[load.view]]'''<br /> | |
− | + | '''[[load.view.v]]'''<br /> | |
− | + | '''[[set.view]]'''<br /> | |
− | + | '''[[set.view.v]]'''<br /> | |
− | + | [[Category:Commands]]<br /> | |
− | |||
− | |||
− |
Latest revision as of 09:54, 30 March 2019
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
<syntaxhighlight lang="agi"> load.view(8) [ load view 8 ... [ do something with it ... [ make sure view 8 is no longer used before unloading discard.view(8); </syntaxhighlight>
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