Closed MikuAuahDark closed 3 months ago
Here are currently my proposals for additional fields:
arraytype
- Valid only for type = 'table'
. Provides information about the underlying values in the array. For example, arraytype = 'PixelFormat'
means it returns array of PixelFormat
values.tabletype
- Valid only for type = 'table'
. Provides information about the underlying values of the key-value pairs in the table. For example, tabletype = {'string', 'number'}
means it returns table which the keys are 'string'
and the values are 'number'
.signature
- Valid only for type = 'function'
. Provides additional type signature for a function argument. All key-value fields in the variants
array member is valid. This is useful on function such as ImageData:mapPixels
.tablearray
- Valid only on type = 'table'
with table
key. This key is used to indicate that the parameter is an array of said structure. This is useful on function such as love.graphics.newMesh
.Do note that arraytype = anything
and tabletype = {'number', anything}
are not equal. The former assumes linear arrays without holes while the latter can contain holes (or even non-integers). That's why they're separated.
I'll probably start working on this anytime soon, if I didn't forgot.
This will be useful for type annotations that, for example, supports array tables, annotated function return type, etc.