diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-12 15:34:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-12 15:34:44 -0300 |
commit | f1a1eda7c5d23776834afeb6a13ba943dbaa8870 (patch) | |
tree | ec18f04e507c7751d1a5efb9d4d80dd66ceec809 | |
parent | 41259bff31dbb904edfb8070006ccb15577f8f04 (diff) | |
download | lua-f1a1eda7c5d23776834afeb6a13ba943dbaa8870.tar.gz lua-f1a1eda7c5d23776834afeb6a13ba943dbaa8870.tar.bz2 lua-f1a1eda7c5d23776834afeb6a13ba943dbaa8870.zip |
old trick in "strsub" does not work with new hash table for strings.
-rw-r--r-- | strlib.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** String library to LUA | 3 | ** String library to LUA |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_strlib="$Id: strlib.c,v 1.16 1996/01/26 12:11:28 roberto Exp roberto $"; | 6 | char *rcs_strlib="$Id: strlib.c,v 1.18 1996/02/12 18:32:40 roberto Exp $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -125,10 +125,10 @@ static void str_sub (void) | |||
125 | lua_pushliteral(""); | 125 | lua_pushliteral(""); |
126 | else | 126 | else |
127 | { | 127 | { |
128 | char temp = s[end]; | 128 | luaI_addchar(0); |
129 | s[end] = 0; | 129 | while (start <= end) |
130 | lua_pushstring (&s[start-1]); | 130 | luaI_addchar(s[start++ - 1]); |
131 | s[end] = temp; | 131 | lua_pushstring (luaI_addchar(0)); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||