A data structure that represents an array of float.
More efficient structure for handling buffers in Lua.
Constructors and accessors
stingray.Float32Array() stingray.Float32Array.add() stingray.Float32Array.div() stingray.Float32Array.mul() stingray.Float32Array.sqrt() stingray.Float32Array.sqrt() stingray.Float32Array.sub() |
Related sample code
Other related reference items
add ( a, b ) : stingray.Float32ArrayAdds together two Float32Array or a Float32Array and a number and returns the result.
|
a : | any(stingray.Float32Array, number) | One addend The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
b : | any(stingray.Float32Array, number) | The other addend The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
The result |
Related sample code
div ( a, b ) : stingray.Float32ArrayDivides two Float32Array or a Float32Array and a number and returns the result.
|
a : | any(stingray.Float32Array, number) | One value The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
b : | any(stingray.Float32Array, number) | The other value The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
The result |
Dividing with zero will give zero as the result, rather than an FPU exception.
Related sample code
get ( self, i ) : numberLooks up an element in a float array.
|
self : | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. | |
i : | integer | The item to get. |
number |
The i'th element of the array. |
mul ( a, b ) : stingray.Float32ArrayMultiplies two Float32Array or a Float32Array and a number and returns the result.
|
a : | any(stingray.Float32Array, number) | One value The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
b : | any(stingray.Float32Array, number) | The other value The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
The result |
Related sample code
push ( self, value )Pushes a new value to the end of the array
|
self : | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. | |
value : | number | The value to push. |
This function does not return any values. |
resize ( self, size )Resizes the array.
|
self : | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. | |
size : | integer | The new size. |
This function does not return any values. |
set ( self, i, value )Sets the i'th item in the array.
|
self : | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. | |
i : | integer | The item to get. |
value : | number | The value to set. |
This function does not return any values. |
size ( self ) : integerReturns the size of the array.
|
self : | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. |
integer |
The size of the array. |
sqrt ( self ) : stingray.Float32ArrayComputes the square root of all items.
|
self : | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. |
An array with the square root of all items. |
Related sample code
sqrt ( a ) : stingray.Float32ArrayInterleaves the float values from the listed arrays in a new array and returns it.
|
a : | The arrays to interleave. The + notation indicates that there may be one or more instances of the specified type. |
An array with all the values interleaved. |
All arrays must be of the same size.
sub ( a, b ) : stingray.Float32ArraySubtracts two Float32Array or a Float32Array and a number and returns the result.
|
a : | any(stingray.Float32Array, number) | One value The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
b : | any(stingray.Float32Array, number) | The other value The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
The result |
Related sample code
swap ( a, b )Swaps the content of arrays a and b.
|
a : | One array. | |
b : | Another array. |
This function does not return any values. |
Related sample code