GroupRemoveUnit
native GroupRemoveUnit takes [[[group|group.html]]] whichGroup, [[[unit|unit.html]]] whichUnit returns nothing
globals
group g = [[[CreateGroup|creategroup.html]]]()
endglobals
function gameStart takes [[[nothing|nothing.html]]] returns [[[nothing|nothing.html]]]
local unit u = CreateUnit(Player(0), '[[[uloc|aloc.html]]]', 0, 0, 0) // Не игнорирует [[[aloc|aloc.html]]]
call [[[GroupAddUnit|groupaddunit.html]]](g, u)
call ConsolePrint([[[I2S|i2s.html]]]([[[GroupGetCount|groupgetcount.html]]](g))) // 1
call GroupRemoveUnit(g, [[[null|null.html]]]) // Безопасна при работе с [[[null|null.html]]]
call ConsolePrint([[[I2S|i2s.html]]]([[[GroupGetCount|groupgetcount.html]]](g))) // 1
call GroupRemoveUnit(g, u)
call ConsolePrint([[[I2S|i2s.html]]]([[[GroupGetCount|groupgetcount.html]]](g))) // 0
endfunction
function [[[main|main.html]]] takes [[[nothing|nothing.html]]] returns [[[nothing|nothing.html]]]
call TimerStart(CreateTimer(), 0, false, function gameStart)
endfunction
Last modified: 22 October 2024