• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Calling functions that return handles

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

I was curious if when one calls a function that returns a handle, does that cause a leak, or does the game know to destroy that handle automatically (since it's not being stored in any variable outside the function because our function is preceded by a call)

Here is an example.

JASS:
function foo takes nothing returns rect
  return Rect(0.00, 0.00, 0.00, 0.00)
endfunction
...
call foo() //is there now a leaked rect handle in the map?
...
local rect r
set r = foo() //do I need it this way?
call RemoveRect(r)
set r = null
 
Status
Not open for further replies.
Top