Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lua-messagepack
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Debian Lua Group
lua-messagepack
Commits
14ddd71b
Commit
14ddd71b
authored
Jul 28, 2017
by
Pierre Chapuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid an error when calling ipairs() on packers
parent
dc12b017
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
src/MessagePack.lua
src/MessagePack.lua
+4
-1
src5.3/MessagePack.lua
src5.3/MessagePack.lua
+4
-1
test/02-except.t
test/02-except.t
+7
-3
No files found.
src/MessagePack.lua
View file @
14ddd71b
...
...
@@ -60,7 +60,10 @@ local function checktype (caller, narg, arg, tname)
end
local
packers
=
setmetatable
({},
{
__index
=
function
(
t
,
k
)
error
(
"pack '"
..
k
..
"' is unimplemented"
)
end
__index
=
function
(
t
,
k
)
-- return nil for k == 1 to avoid breaking ipairs()
if
k
~=
1
then
error
(
"pack '"
..
k
..
"' is unimplemented"
)
end
end
})
m
.
packers
=
packers
...
...
src5.3/MessagePack.lua
View file @
14ddd71b
...
...
@@ -43,7 +43,10 @@ local function checktype (caller, narg, arg, tname)
end
local
packers
=
setmetatable
({},
{
__index
=
function
(
t
,
k
)
error
(
"pack '"
..
k
..
"' is unimplemented"
)
end
__index
=
function
(
t
,
k
)
-- return nil for k == 1 to avoid breaking ipairs()
if
k
~=
1
then
error
(
"pack '"
..
k
..
"' is unimplemented"
)
end
end
})
m
.
packers
=
packers
...
...
test/02-except.t
View file @
14ddd71b
...
...
@@ -2,7 +2,7 @@
require
'
Test.More
'
plan
(
2
3
)
plan
(
2
4
)
local
mp
=
require
'
MessagePack
'
...
...
@@ -114,6 +114,10 @@ error_like( function ()
lives_ok
(
function
()
mp
.
packers
['
fixext4
']({},
1
,
'
1234
')
end
,
"
fixext4
"
)
end
,
"
fixext4
"
)
lives_ok
(
function
()
for
_
in
ipairs
(
mp
.
packers
)
do
end
end
,
"
cannot iterate packers
"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment