- Joined
- Nov 21, 2012
- Messages
- 835
In GUI there is "skip remaining actions" which means "return" in JASS. I wonder is it possible in Lua to break ForGroup in the middle.
Suppose we have 50 units in group and if any of these units has life lower then max, then we return false
I've tried this, but script always continues over all units on group
Suppose we have 50 units in group and if any of these units has life lower then max, then we return false
I've tried this, but script always continues over all units on group
Lua:
function GroupHealthy(g)
local result=true
ForGroup(g, function()
local u=GetEnumUnit()
local l = GetWidgetLife(u)
if l < BlzGetUnitMaxHP(u) then
result=false
print("damaged " .. GetHandleId(u) .. ", life " .. l)
return -- <-- this doesn't work
else
print("full hp " .. GetHandleId(u) .. ", life " .. l)
end
end)
return result
end