Module data
Lua bindings to interact with datas.
Functions
__gc (data) | Frees a data. |
__eq (d1, d2) | Compares two datas to see if they are the same. |
new (size, type) | Opens a new data. |
get (data, pos) | Gets the value of an element. |
set (data, pos, value) | Sets the value of an element. |
getSize (data) | Gets the number of elements. |
getString (data) | Returns the data contents as a string. |
paste (dest, source, dx, sx, sw) | Writes the contents of "source" into "dest". |
addWeighted (A, B, alpha, beta, bias) | Returns alpha*A + beta*B + bias |
convolve2d (I, iw, ih, K, kw, kh) | Does a convolution. |
Functions
- __gc (data)
-
Frees a data.
Parameters:
- data Data Data to free.
- __eq (d1, d2)
-
Compares two datas to see if they are the same.
Parameters:
- d1 Data Data 1 to compare.
- d2 Data Data 2 to compare.
Returns:
-
boolean
true if both datas are the same.
- new (size, type)
-
Opens a new data.
Parameters:
- size number Size to allocate for data.
- type string Type of the data to create ("number")
Returns:
-
Data
New data object.
- get (data, pos)
-
Gets the value of an element.
Parameters:
- data Data Data to index.
- pos number Element position.
Returns:
-
number
The entry.
- set (data, pos, value)
-
Sets the value of an element.
Parameters:
- data Data Data to index.
- pos number Element position.
- value number Value to set it to.
- getSize (data)
-
Gets the number of elements.
Parameters:
- data Data ...
Returns:
-
number
Data size.
- getString (data)
-
Returns the data contents as a string.
Parameters:
- data Data ...
Returns:
-
string
The bytes inside.
- paste (dest, source, dx, sx, sw)
-
Writes the contents of "source" into "dest".
Parameters:
- dest Data Destination.
- source Data Source.
- dx number Offset from start of destination.
- sx number Offset from start of source.
- sw number Number of data elements to copy.
- addWeighted (A, B, alpha, beta, bias)
-
Returns alpha*A + beta*B + bias
Parameters:
- A Data as above.
- B Data as above.
- alpha number as above.
- beta number as above.
- bias number as above.
Returns:
-
Data
alpha*A + beta*B + bias.
- convolve2d (I, iw, ih, K, kw, kh)
-
Does a convolution. You'd rather be writing shaders, right?
Parameters:
- I Data left-hand side of the convolution operator.
- iw number width of I.
- ih number height of I.
- K Data right-hand side of the convolution operator.
- kw number width of K.
- kh number height of K.
Returns:
-
(I*K, width, height)