muln


The muln function multiples a general lua table by a number. The table may contain non-numeric values, named keys, and sub-tables. Only numeric values found in the table are used in the calculation. The related mul function returns the minimum value of a 1-dimensional array or CImage. Since an array is a specific type of table that contains only numbers or sub-tables, this function can also be used for arrays.

Syntax

result = muln( tbl, value )

bullet.gif    where tbl is a general lua table.

bullet.gif    value is a number.

bullet.gif    result is returned as a new table.

Examples

The following script multiplies a 1-dimensional array by 3200.5.

t = muln( array, 3200.5 )

-- multiply the table by the value

  

The next script multiplies the numeric members of a more complex table by 3200.5. Only the 4 numeric values are multiplied.

tbl = { 15, a=5.5, z={"c", 20}, -12 }

 

t = muln( tbl, 3200.5 )

-- multiply the table by the value

Related Topics

Table and Array Functions, mul, divn


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.