diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:49:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:49:40 -0300 |
commit | c8897f2b082616bd5eb5328d3f260273adb53fbd (patch) | |
tree | 32187773078e9c6f60a2aa0c88df721af0649fba | |
parent | 6bb2cac3dbb440b6323979ad2908f61351dd3196 (diff) | |
download | lua-github-c8897f2b082616bd5eb5328d3f260273adb53fbd.tar.gz |
counter for gsub only when there is a table (to keep full compatibility)
-rw-r--r-- | strlib.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -3,7 +3,7 @@ ** String library to LUA */ -char *rcs_strlib="$Id: strlib.c,v 1.44 1997/06/18 21:20:45 roberto Exp roberto $"; +char *rcs_strlib="$Id: strlib.c,v 1.45 1997/06/19 17:45:28 roberto Exp roberto $"; #include <string.h> #include <stdio.h> @@ -390,10 +390,11 @@ static void add_s (lua_Object newp, lua_Object table, int n) struct lbuff oldbuff; int status; lua_beginblock(); - if (lua_istable(table)) + if (lua_istable(table)) { lua_pushobject(table); + lua_pushnumber(n); + } push_captures(); - lua_pushnumber(n); /* function may use lbuffer, so save it and create a new one */ oldbuff = lbuffer; lbuffer.b = NULL; lbuffer.max = lbuffer.size = 0; |