From f8846c2c39fbc62c9284c613ef4a196bb090f071 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 3 Jan 2020 16:54:59 +0000 Subject: [PATCH] Add a tostring metamethod for bignum objects. See #1876 --- nse_openssl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nse_openssl.cc b/nse_openssl.cc index 03aa64c45..3126cf795 100644 --- a/nse_openssl.cc +++ b/nse_openssl.cc @@ -650,6 +650,9 @@ LUALIB_API int luaopen_openssl(lua_State *L) { // metatable.__index = metatable lua_pushvalue( L, -1 ); lua_setfield( L, -2, "__index" ); + // metatable.__tostring = bignum_bn2hex + lua_pushcfunction( L, l_bignum_bn2hex ); + lua_setfield( L, -2, "__tostring" ); // register methods luaL_setfuncs(L, bignum_methods, 0);