summaryrefslogtreecommitdiff
path: root/strlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-02-12 15:34:44 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-02-12 15:34:44 -0300
commitf1a1eda7c5d23776834afeb6a13ba943dbaa8870 (patch)
treeec18f04e507c7751d1a5efb9d4d80dd66ceec809 /strlib.c
parent41259bff31dbb904edfb8070006ccb15577f8f04 (diff)
downloadlua-github-f1a1eda7c5d23776834afeb6a13ba943dbaa8870.tar.gz
old trick in "strsub" does not work with new hash table for strings.
Diffstat (limited to 'strlib.c')
-rw-r--r--strlib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/strlib.c b/strlib.c
index 80c412a9..02e291b0 100644
--- a/strlib.c
+++ b/strlib.c
@@ -3,7 +3,7 @@
** String library to LUA
*/
-char *rcs_strlib="$Id: strlib.c,v 1.16 1996/01/26 12:11:28 roberto Exp roberto $";
+char *rcs_strlib="$Id: strlib.c,v 1.18 1996/02/12 18:32:40 roberto Exp $";
#include <string.h>
#include <stdio.h>
@@ -125,10 +125,10 @@ static void str_sub (void)
lua_pushliteral("");
else
{
- char temp = s[end];
- s[end] = 0;
- lua_pushstring (&s[start-1]);
- s[end] = temp;
+ luaI_addchar(0);
+ while (start <= end)
+ luaI_addchar(s[start++ - 1]);
+ lua_pushstring (luaI_addchar(0));
}
}