HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Two things

11-29-2004, 12:22 PM#1
a thing
1. Do groups, locations, forces, and effects taken as parameters into a function leak if not destroyed somewhere in the function?

2. Is there any way to detect what code was used to pass a parameter into a function in the function that the took the parameter? I don't want to know what the function(s) used returned or the value of the variable, just to detect what variable was used.
11-29-2004, 01:19 PM#2
-={tWiStÄr}=-
1. that should be a no.. not completely sure though.
2. so you want to know what variable was passed. so like
MyFunc(udg_Stuff)
you want to somehow get udg_Stuff? but not the value of it.. i dont know if thats possible.
11-29-2004, 02:41 PM#3
AIAndy
1. When you pass a group (or any other handle) as parameter, then that group is not copied. Instead only the reference is copied. So the group you refer to inside the function is the same as the one that has been passed.

An example:
Code:
function foo takes group g returns nothing
  call GroupAddUnit(g, udg_u)
endfunction

function bar takes nothing returns nothing
  local group g = CreateGroup()
  call foo(g)
  // at this point g contains the global unit udg_u
endfunction