• 🏆 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!

Leak in Lua

Status
Not open for further replies.
Level 18
Joined
Nov 21, 2012
Messages
835
Hey, should I set variable u to nil inside ForGroup, or it is not necessary?
Lua:
function Group_Mixed(g)
local walkers=false
local flyers=false
   ForGroup(g, function()
   local u = GetEnumUnit()
   if UnitAlive(u) then
       if IsUnitType(u, UNIT_TYPE_FLYING) then
            flyers=true
        elseif not IsUnitLoaded(u) then
            walkers=true
        end
   end
   u=nil
   end)
   return walkers and flyers
end
 
Status
Not open for further replies.
Top