Easy question...
by Jared Hoberock · in Torque Game Engine · 02/27/2002 (1:33 am) · 1 replies
Is there a delete operator analogous to the new operator used in the scripts? Or do objects allocated in script functions get deleted when the function exits? For example:
function generateMission()
{
...
new TerrainBlock(Terrain)
{
...
}; // end TerrainBlock()
...
}; // end function generateMission()
Will Terrain stay resident in memory after this function exits? I don't want any memory leaks nor do I want this object to interfere with the real TerrainBlock that gets loaded when a mission begins.
Thanks for your input,
J
function generateMission()
{
...
new TerrainBlock(Terrain)
{
...
}; // end TerrainBlock()
...
}; // end function generateMission()
Will Terrain stay resident in memory after this function exits? I don't want any memory leaks nor do I want this object to interfere with the real TerrainBlock that gets loaded when a mission begins.
Thanks for your input,
J
About the author
Torque Owner Daniel Neilsen
The missioncleanup group gets deleted on mission end along with all the objects in it.
so in your previous example:
function generateMission() { ... %bla = new TerrainBlock(Terrain) { ... }; // end TerrainBlock() MissionCleanup.add( %bla ); ... }; // end function generateMission()you can of course manually delete an object as well
Terrain.delete();