Forbit use of (optional) in function headers, always require a value

This commit is contained in:
jonpas 2023-05-01 17:33:07 +02:00
parent c4c4156c0a
commit 48a4e9682c
8 changed files with 23 additions and 23 deletions

View File

@ -7,9 +7,9 @@
*
* Arguments:
* 0: items only misc items <ARRAY of STRING>
* 1: tooltip <STRING> (Optional)
* 2: picture path <STRING> (Optional)
* 3: override a specific button (0-9) <NUMBER> (Optional)
* 1: tooltip <STRING> (default: "")
* 2: picture path <STRING> (default: QPATHTOF(data\iconCustom.paa))
* 3: override a specific button (0-9) <NUMBER> (default: -1)
*
* Return Value:
* successful: number of the slot (0-9); error: -1 <NUMBER>

View File

@ -5,8 +5,8 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Muzzle <STRING> (Optional)
* 2: Firemode <STRING> (Optional)
* 1: Muzzle <STRING> (default: current weapon muzzle)
* 2: Firemode <STRING> (default: current weapon fire mode)
*
* Return Value:
* Weapon/Mode index <NUMBER>
@ -18,14 +18,14 @@
*/
params ["_unit"];
(weaponState _unit) params ["", "_currentMuzzle", "_currentFiremode"];
(weaponState _unit) params ["", "_currentMuzzle", "_currentFiremode"];
params ["", ["_muzzle", _currentMuzzle], ["_firemode", _currentFireMode]];
private _weapons = _unit weaponsInfo [_muzzle, false];
private _index = -1;
private _weapons = _unit weaponsInfo [_muzzle, false];
private _index = -1;
{
_x params ["_xIndex", "", "", "", "_xFiremode"];
if (_xFiremode == _firemode) exitWith { _index = _xIndex; };
if (_xFiremode == _firemode) exitWith { _index = _xIndex; };
} forEach _weapons;
_index

View File

@ -5,7 +5,7 @@
*
* Arguments:
* 0: Number to 'digitize' <NUMBER>
* 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. <NUMBER> (optional)
* 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. <NUMBER> (default: 1)
*
* Return Value:
* Digits. The maximum count is six digits. <ARRAY>
@ -16,7 +16,7 @@
* Public: Yes
*/
params ["_number", "_minLength"];
params ["_number", ["_minLength", 1]];
_number = [_number min 999999, _minLength] call CBA_fnc_formatNumber;

View File

@ -10,12 +10,12 @@
* 2: Icon file path or Array of icon file path and hex color ("" for default icon) <STRING|ARRAY>
* 3: Statement <CODE>
* 4: Condition <CODE>
* 5: Insert children code <CODE> (Optional)
* 6: Action parameters <ANY> (Optional)
* 7: Position (Position array, Position code or Selection Name) <ARRAY>, <CODE> or <STRING> (Optional)
* 8: Distance <NUMBER> (Optional)
* 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (Optional)
* 10: Modifier function <CODE> (Optional)
* 5: Insert children code <CODE> (default: {})
* 6: Action parameters <ANY> (default: [])
* 7: Position (Position array, Position code or Selection Name) <ARRAY>, <CODE> or <STRING> (default: {[0, 0, 0]})
* 8: Distance <NUMBER> (default: 2)
* 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (default: all false)
* 10: Modifier function <CODE> (default: {})
*
* Return Value:
* Action <ARRAY>

View File

@ -5,7 +5,7 @@
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Disable <BOOL> (optional)
* 1: Disable <BOOL> (default: true)
*
* Return Value:
* None

View File

@ -9,8 +9,8 @@
* 2: Required Item <STRING>
* 3: Textures Paths <ARRAY>
* 4: Icon Path <STRING> (default: "")
* 5: Material Paths <ARRAY> (optional)
* 6: Tag Model <STRING> (optional)
* 5: Material Paths <ARRAY> (default: [])
* 6: Tag Model <STRING> (default: "UserTexture1m_F")
*
* Return Value:
* Sucessfully Added Tag <BOOL>

View File

@ -6,8 +6,8 @@
* Arguments:
* 0: Unit <OBJECT>
* 1: The colour of the tag (valid colours are black, red, green and blue or full path to custom texture) <STRING>
* 2: Material of the tag <STRING> (Optional)
* 3: Tag Model <STRING> (optional)
* 2: Material of the tag <STRING> (default: "")
* 3: Tag Model <STRING> (default: "UserTexture1m_F")
*
* Return Value:
* Sucess <BOOL>

View File

@ -161,7 +161,7 @@ class FunctionFile:
arguments = []
for argument in lines:
valid = re.match(r"^(\d+):\s(.+?)\<([\s\w,\|]+?)\>( \([Oo]ptional\))?(\s\(default: (.+)\))?$", argument)
valid = re.match(r"^(\d+):\s(.+?)\<([\s\w,\|]+?)\>( )?(\s\(default: (.+)\))?$", argument)
if valid:
arg_index = valid.group(1)