• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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