Buffer:getFormat
EditReturns the format the Buffer was created with.
format = Buffer:getFormat()
Arguments
None
Returns
Name | Type | Description |
format | table | A list of fields comprising the format. |
.[].name | string | The name of the field (if fields were created with names). |
.[].type | * |
The DataType of the field, or a recursive table with the sub-format.
|
.[].offset | number | The offset of the field relative to its parent, in bytes. |
.[].length | number |
The array length of the field, or nil if it's not an array.
|
.[].stride | number |
The stride of the field in bytes, or nil if it's not an array.
|
Example
function lovr.load()
buffer = lovr.graphics.newBuffer({
{ 'a', 'float' },
{ 'b', 'un16x2' }
})
for i, field in ipairs(buffer:getFormat()) do
print(('%s: %s'):format(field.name, field.type))
end
-- prints the following:
-- a: f32
-- b: un16x2
end