Exactly right. EnumGroup() returns domain and local groups. To simplify things, I strip the domain part off so that only the group name is left.
Just to clarify the function definition.
The values between the parentheses "()" are values which are passed to the function. These cannot be changed and are not passed back to the calling script.
You may only pass back two things from the function. You may pass back an error value by using "Exit n" where n is an integer. This will set the @ERROR macro.
You may pass back a single value by setting a variable which has the same name as the function. Take the following example:
Code:
Dim $iVar1, $iVar2
$iVar1="10"
$iVar2=Increment($iVar1)
Function Increment($iVar1)
$iVar1=$iVar1+1
$Increment=$iVar1
Exit 0
EndFunction
This when called this function will always set @ERROR to zero.
The function simply takes the value passed (10), adds one to it and because is it assigned to a variable with the same name as the function it gets returned to the main script.
This means that $iVar2 is now set to 11. But what about $iVar1?
$iVar1 is still 10. This is because when you call a function the values are copied to a new variable. the variable may have the same name, but it is not the same variable as the one in the main script. The version of $iVar1 in the main script is hidden and not accessible in the function.
I hope that has cleared some things up for you.