subn
The subn function subtracts a value from a general lua table that may contain non-numeric values, named keys, and sub-tables. Only numeric values found in the table are used in the calculation. The related sub function subtracts a number to a 1-dimensional array, CImage, or list of numbers. Since an array is a specific type of table that contains only numbers or sub-tables, this function can also be used for arrays.
new_table = subn( tbl, value )
tbl is a general lua table.
value is a number.
new_table is returned as a table.
The following script subtracts 3200.5 from all members of a 1-dimensional array.
|
-- create 10000 random numbers |
|
-- subtract 3200.5 from all members of the array |
The next script subtracts 3200.5 from the values in a complex, ugly table:
|
|
|
-- subtract 3200.5 |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.