diff options
-rw-r--r-- | lvm.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.67 2006/09/11 14:07:24 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.68 2006/09/19 13:57:50 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -281,8 +281,12 @@ void luaV_concat (lua_State *L, int total, int last) { | |||
281 | if (!tostring(L, top-2) || !tostring(L, top-1)) { | 281 | if (!tostring(L, top-2) || !tostring(L, top-1)) { |
282 | if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) | 282 | if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) |
283 | luaG_concaterror(L, top-2, top-1); | 283 | luaG_concaterror(L, top-2, top-1); |
284 | } else if (tsvalue(top-1)->len > 0) { /* if len=0, do nothing */ | 284 | } else if (tsvalue(top-1)->len == 0) { /* second operand is empty? */ |
285 | /* at least two string values; get as many as possible */ | 285 | /* do nothing; result is already first operand */ ; |
286 | } else if (tsvalue(top-2)->len == 0) { /* fist operand is empty? */ | ||
287 | setsvalue2s(L, top-2, rawtsvalue(top-1)); /* result is second op. */ | ||
288 | } else { | ||
289 | /* at least two (non-empty) string values; get as many as possible */ | ||
286 | size_t tl = tsvalue(top-1)->len; | 290 | size_t tl = tsvalue(top-1)->len; |
287 | char *buffer; | 291 | char *buffer; |
288 | int i; | 292 | int i; |