Skip to content

Commit 0eec0d9

Browse files
authored
Merge pull request #1681 from Lyrth/fix--ffi-meta
Fix ffi meta
2 parents 679b32f + 12fd369 commit 0eec0d9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

meta/template/ffi.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
---@meta
33

44
---@class ffi.namespace*: table
5+
---@field [string] function
56

6-
---@class ffi.cdecl*: string
77
---@class ffi.ctype*: userdata
8+
---@overload fun(init?: any, ...): ffi.cdata*
9+
---@overload fun(nelem?: integer, init?: any, ...): ffi.cdata*
810
local ctype
11+
12+
---@class ffi.cdecl*: string
913
---@class ffi.cdata*: userdata
10-
---@alias ffi.ct* ffi.cdecl*|ffi.ctype*|ffi.cdata*
11-
---@class ffi.cb*: userdata
14+
---@alias ffi.ct* ffi.ctype*|ffi.cdecl*|ffi.cdata*
15+
---@class ffi.cb*: ffi.cdata*
1216
local cb
1317
---@class ffi.VLA*: userdata
1418
---@class ffi.VLS*: userdata
@@ -20,35 +24,34 @@ local cb
2024
---@field arch string
2125
local ffi = {}
2226

23-
---@param def string
24-
function ffi.cdef(def) end
27+
---@param def string
28+
---@param params? any
29+
function ffi.cdef(def, params, ...) end
2530

2631
---@param name string
2732
---@param global? boolean
2833
---@return ffi.namespace* clib
2934
---@nodiscard
3035
function ffi.load(name, global) end
3136

37+
---@overload fun(ct: ffi.ct*, init: any, ...)
3238
---@param ct ffi.ct*
3339
---@param nelem? integer
3440
---@param init? any
3541
---@return ffi.cdata* cdata
3642
---@nodiscard
3743
function ffi.new(ct, nelem, init, ...) end
3844

39-
---@param nelem? integer
40-
---@param init? any
41-
---@return ffi.cdata* cdata
42-
function ffi.ctype(nelem, init, ...) end
43-
44-
---@param ct ffi.ct*
45+
---@param ct ffi.ct*
46+
---@param params? any
4547
---@return ffi.ctype* ctype
4648
---@nodiscard
47-
function ffi.typeof(ct) end
49+
function ffi.typeof(ct, params, ...) end
4850

4951
---@param ct ffi.ct*
5052
---@param init any
5153
---@return ffi.cdata* cdata
54+
---@nodiscard
5255
function ffi.cast(ct, init) end
5356

5457
---@param ct ffi.ct*

0 commit comments

Comments
 (0)