Hi, I'm creating some custom types for my space game.
If I use this function in a module (inside a type):
It works fine.
It even compiles without errors.
But when I copy the same function into an empty bmx file and try to run it (even without extra code to call the function), using the button "Build and Run", I get an error that "b" is a duplicate identifier.
And the IDE points to line 9 ("Local b:TWeaponType = TWeaponType(a)") inside the IF-block "If a.IsWeapon()".
Does Local work differently if used in a module?
If I use this function in a module (inside a type):
Function FindCommodity:TCommodityType(CommName$) For Local a:TCommodityType = EachIn TCommodityType.AComm If a.IsWare() Then Local b:TWareType = TWareType(a) If b.Name$ = CommName$ Then Return a EndIf If a.IsWeapon() Then Local b:TWeaponType = TWeaponType(a) If b.Name$ = CommName$ Then Return a EndIf If a.IsMissile() Then Local b:TMissileType = TMissileType(a) If b.Name$ = CommName$ Then Return a EndIf If a.IsUpgrade() Then Local b:TUpgradeType = TUpgradeType(a) If b.Name$ = CommName$ Then Return a EndIf Next End Function
It works fine.
It even compiles without errors.
But when I copy the same function into an empty bmx file and try to run it (even without extra code to call the function), using the button "Build and Run", I get an error that "b" is a duplicate identifier.
And the IDE points to line 9 ("Local b:TWeaponType = TWeaponType(a)") inside the IF-block "If a.IsWeapon()".
Does Local work differently if used in a module?