Skip to content

Commit 9a6050e

Browse files
committed
makes linter happy
1 parent 3f9ffd4 commit 9a6050e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
ROCKSPEC: rockspecs/lua-protobuf-scm-1.rockspec
2323
strategy:
2424
matrix:
25-
luaVersion: ["5.1", "5.2", "5.3", "5.4", "luajit-2.0.5", "luajit-2.1.0-beta3"]
25+
luaVersion: ["5.1", "5.2", "5.3", "5.4", "luajit-openresty"]
2626
os: ["ubuntu-latest"]
2727
steps:
2828
- name: Install LCov

pb.c

100755100644
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,17 +1624,18 @@ static size_t lpbE_enum(lpb_Env *e, const pb_Field *f, int *pexist, int idx) {
16241624
lpb_name(e->LS, lpb_toslice(L, idx)))) != NULL) {
16251625
if (pexist) *pexist = (ev->number != 0);
16261626
return lpb_checkmem(L, pb_addvarint32(b, ev->number));
1627-
} else if (type != LUA_TSTRING) {
1628-
argcheck(L, 0, 2, "number/string expected at field '%s', got %s",
1629-
(const char*)f->name, luaL_typename(L, idx));
1630-
return 0;
1631-
} else {
1627+
} else if (type == LUA_TSTRING) {
16321628
uint64_t v = lpb_tointegerx(L, idx, &type);
16331629
if (pexist) *pexist = (v != 0);
16341630
if (!type)
16351631
argcheck(L, 0, 2, "can not encode unknown enum '%s' at field '%s'",
16361632
lua_tostring(L, -1), (const char*)f->name);
16371633
return lpb_checkmem(L, pb_addvarint64(b, v));
1634+
} else {
1635+
argcheck(L, 0, 2, "number/string expected at field '%s', got %s",
1636+
(const char*)f->name, luaL_typename(L, idx));
1637+
if (pexist) *pexist = 0;
1638+
return 0;
16381639
}
16391640
}
16401641

0 commit comments

Comments
 (0)