From 49d0192120c6e3485efd10725ea851b538222e6b Mon Sep 17 00:00:00 2001 From: William Ahern Date: Fri, 8 Jan 2016 13:10:27 +0800 Subject: try to avoid negative stack indices with luaL_checkstring as error messages are confusing (per daurnimator) --- src/openssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openssl.c b/src/openssl.c index c777e14..4eba534 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -289,7 +289,7 @@ static int auxL_swapmetatable(lua_State *, const char *); static int auxL_swapmetasubtable(lua_State *, const char *, const char *); static int interpose(lua_State *L, const char *mt) { - if (!strncmp("__", luaL_checkstring(L, -2), 2)) { + if (!strncmp("__", luaL_checkstring(L, lua_absindex(L, -2)), 2)) { return auxL_swapmetatable(L, mt); } else { return auxL_swapmetasubtable(L, mt, "__index"); -- cgit v1.2.3-55-g6feb