diff options
Diffstat (limited to 'epan/wslua/lua_bitop.c')
-rw-r--r-- | epan/wslua/lua_bitop.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/epan/wslua/lua_bitop.c b/epan/wslua/lua_bitop.c index 5fb7789ec6..129eeac616 100644 --- a/epan/wslua/lua_bitop.c +++ b/epan/wslua/lua_bitop.c @@ -81,7 +81,7 @@ static UBits barg(lua_State *L, int idx) #error "Unknown number type, check LUA_NUMBER_* in luaconf.h" #endif if (b == 0 && !lua_isnumber(L, idx)) - luaL_typerror(L, idx, "number"); + luaL_error(L, "bad argument %d (number expected, got %s)", idx, lua_typename(L, lua_type(L, idx))); return b; } @@ -174,7 +174,14 @@ LUALIB_API int luaopen_bit(lua_State *L) msg = "arithmetic right-shift broken"; luaL_error(L, "bit library self-test failed (%s)", msg); } + +#if LUA_VERSION_NUM >= 502 + luaL_newlib(L, bit_funcs); + lua_setglobal(L, "bit"); +#else luaL_register(L, "bit", bit_funcs); +#endif + return 1; } |