aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/lua_bitop.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-06-25 20:28:14 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-06-25 20:28:14 +0000
commit6efe4ea27c322162027bf507524484bf553f896b (patch)
tree6ecaef4428ee3da5adab4f49b759ca2f805ecefa /epan/wslua/lua_bitop.c
parentf272aaeb803e7c8e7dd9039cd680e114afbe0319 (diff)
From Tony Trinh:
Update Lua from 5.1 to 5.2 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7400 svn path=/trunk/; revision=43479
Diffstat (limited to 'epan/wslua/lua_bitop.c')
-rw-r--r--epan/wslua/lua_bitop.c9
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;
}