Fix /sub actually allowing more than two vals now - Fix by subtracting all from the first value - Update the definition too

224249a0d21dd076ebbf73bc990ac8f66e7137f6

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +4 -3Ignore whitespace
public/scripts/variables.js+4 -3
@@ -730,7 +730,7 @@ function maxValuesCallback(args, value) {
730}730}
731731
732function subValuesCallback(args, value) {732function subValuesCallback(args, value) {
733 return performOperation(value, (array) => array[0] - array[1], false, args._scope);733 return performOperation(value, (array) => array.reduce((a, b) => a - b, array.shift() ?? 0), false, args._scope);
734}734}
735735
736function divValuesCallback(args, value) {736function divValuesCallback(args, value) {
@@ -1716,14 +1716,15 @@ export function registerVariableCommands() {
1716 returns: 'difference of the provided values',1716 returns: 'difference of the provided values',
1717 unnamedArgumentList: [1717 unnamedArgumentList: [
1718 SlashCommandArgument.fromProps({1718 SlashCommandArgument.fromProps({
1719 description: 'values to find the difference',1719 description: 'values to subtract, starting form the first provided value',
1720 typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],1720 typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],
1721 isRequired: true,1721 isRequired: true,
1722 acceptsMultiple: true,1722 acceptsMultiple: true,
1723 enumProvider: commonEnumProviders.variables('all'),1723 enumProvider: commonEnumProviders.numbersAndVariables,
1724 forceEnum: false,1724 forceEnum: false,
1725 }),1725 }),
1726 ],1726 ],
1727 splitUnnamedArgument: true,
1727 helpString: `1728 helpString: `
1728 <div>1729 <div>
1729 Performs a subtraction of the set of values and passes the result down the pipe.1730 Performs a subtraction of the set of values and passes the result down the pipe.