File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 3
3
local PackedValue = {}
4
4
PackedValue .__index = PackedValue
5
5
6
+ --- like {...} except preserve the lenght explicitly
7
+ local function pack_len (...)
8
+ return { n = select (' #' , ... ), ... }
9
+ end
10
+
11
+ --- like unpack() but use the length set by pack_len if present
12
+ local function unpack_len (t )
13
+ return unpack (t , 1 , t .n )
14
+ end
15
+
6
16
function PackedValue .new (...)
7
- local values = vim . F . pack_len (... )
17
+ local values = pack_len (... )
8
18
local tbl = { _values = values }
9
19
return setmetatable (tbl , PackedValue )
10
20
end
@@ -17,7 +27,7 @@ function PackedValue.pcall(self, f)
17
27
end
18
28
19
29
function PackedValue .unpack (self )
20
- return vim . F . unpack_len (self ._values )
30
+ return unpack_len (self ._values )
21
31
end
22
32
23
33
function PackedValue .first (self )
You can’t perform that action at this time.
0 commit comments