summaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 94835ef9..8ed1da11 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -881,6 +881,7 @@ LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) {
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");