From 2e7f771a182df815e8c3d38986a1df0c77d7e4aa Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Sun, 2 Feb 2014 22:49:30 -0500 Subject: Adds support for Lua Int64 and UInt64 operators, functions, and general usefulness, working around bug #9162 until Lua 5.3 is released. The existing Int64 and UInt64 classes provide virtually no usefullness, other than for creating a string of their value. While one could then write Lua code to convert the string to Lua numbers and such, ultimately Lua has no native 64-bit integer support, making such a task difficult to handle in Lua. This change adds a host of functions and operators to the existing Int64 (gint64) and UInt64 (guint64) classes, to enable true 64-bit integer support on par with native Lua numbers. A test script is also provided, which tests the functions/operators. Change-Id: I4c5f8f5219b9a88198902283bd32ddf24c346bbe Reviewed-on: https://code.wireshark.org/review/83 Tested-by: Evan Huus Reviewed-by: Evan Huus --- epan/wslua/wslua_util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'epan/wslua/wslua_util.c') diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c index cc89e99198..9e95d557f4 100644 --- a/epan/wslua/wslua_util.c +++ b/epan/wslua/wslua_util.c @@ -32,6 +32,19 @@ #include #include + +WSLUA_API int wslua__concat(lua_State* L) { + /* Concatenate two objects to a string */ + if (!luaL_callmeta(L,1,"__tostring")) + lua_pushvalue(L,1); + if (!luaL_callmeta(L,2,"__tostring")) + lua_pushvalue(L,2); + + lua_concat(L,2); + + return 1; +} + WSLUA_API gboolean wslua_optbool(lua_State* L, int n, gboolean def) { gboolean val = FALSE; -- cgit v1.2.3