addn
The addn function adds a value to a general lua table that may contain a multi-dimensional array or a mixture of numbers, strings, named keys, and sub-tables. Only numeric values found in the table are used in the calculation. The related add function adds 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 = addn( tbl, value )
tbl is a general lua table.
value is a number.
new_table is the returned table.
The following script adds 3200.5 to all members of a 1-dimensional array.
|
-- create 10000 random numbers |
|
-- add the number to all members of the array |
The next script adds 3200.5 to the values in a complex, ugly table:
|
|
|
-- add 3200.5 |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.