huakim / rpms / lua

Forked from rpms/lua 5 months ago
Clone
Blob Blame History Raw
diff -up lua-5.4.3/src/lauxlib.c.bug5 lua-5.4.3/src/lauxlib.c
--- lua-5.4.3/src/lauxlib.c.bug5	2022-01-24 11:23:19.763391239 -0500
+++ lua-5.4.3/src/lauxlib.c	2022-01-24 11:23:52.554578345 -0500
@@ -881,6 +881,7 @@ LUALIB_API lua_Integer luaL_len (lua_Sta
 
 
 LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
+  idx = lua_absindex(L,idx);
   if (luaL_callmeta(L, idx, "__tostring")) {  /* metafield? */
     if (!lua_isstring(L, -1))
       luaL_error(L, "'__tostring' must return a string");