aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-02-04 00:45:45 -0500
committerStig Bjørlykke <stig@bjorlykke.org>2014-02-04 22:01:01 +0000
commit9eaa61109e034327e1923476595a62fe4da22faa (patch)
tree618c0d986394ae4b6403148e937caf741d9199de /epan
parent953c3ef517231994b5228c1fddb7c62202579d02 (diff)
Fix bug 9720 'Lua: bitop library is missing in Lua 5.2'
In Lua 5.2 the bitop library is missing - it's not getting loaded into the lua global table as "bit", or anything else for that matter. Lua 5.2 has its own bit-operations library ("bit32") which is there, but that one's not as good as bitop and would break back/forward compatibility for lua scripts anyway. Change-Id: I94b7d45bbeb2f637d1c76b0b5c9d8472eebfcaea Reviewed-on: https://code.wireshark.org/review/100 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan')
-rw-r--r--epan/wslua/lua_bitop.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/epan/wslua/lua_bitop.c b/epan/wslua/lua_bitop.c
index b20b575325..2b72082f37 100644
--- a/epan/wslua/lua_bitop.c
+++ b/epan/wslua/lua_bitop.c
@@ -183,9 +183,11 @@ LUALIB_API int luaopen_bit(lua_State *L)
}
#if LUA_VERSION_NUM < 502
luaL_register(L, "bit", bit_funcs);
+ return 1;
#else
luaL_newlib(L, bit_funcs);
+ lua_setglobal(L, "bit"); /* added for wireshark */
+ return 0; /* changed from 1 to 0 for wireshark, since lua_setglobal now pops the table */
#endif
- return 1;
}