diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -634,7 +634,8 @@ static void copy2buff (StkId top, int n, char *buff) { | |||
634 | ** from 'L->top - total' up to 'L->top - 1'. | 634 | ** from 'L->top - total' up to 'L->top - 1'. |
635 | */ | 635 | */ |
636 | void luaV_concat (lua_State *L, int total) { | 636 | void luaV_concat (lua_State *L, int total) { |
637 | lua_assert(total >= 2); | 637 | if (total == 1) |
638 | return; /* "all" values already concatenated */ | ||
638 | do { | 639 | do { |
639 | StkId top = L->top; | 640 | StkId top = L->top; |
640 | int n = 2; /* number of elements handled in this pass (at least 2) */ | 641 | int n = 2; /* number of elements handled in this pass (at least 2) */ |
@@ -840,10 +841,8 @@ void luaV_finishOp (lua_State *L) { | |||
840 | int a = GETARG_A(inst); /* first element to concatenate */ | 841 | int a = GETARG_A(inst); /* first element to concatenate */ |
841 | int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ | 842 | int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ |
842 | setobjs2s(L, top - 2, top); /* put TM result in proper position */ | 843 | setobjs2s(L, top - 2, top); /* put TM result in proper position */ |
843 | if (total > 1) { /* are there elements to concat? */ | 844 | L->top = top - 1; /* top is one after last element (at top-2) */ |
844 | L->top = top - 1; /* top is one after last element (at top-2) */ | 845 | luaV_concat(L, total); /* concat them (may yield again) */ |
845 | luaV_concat(L, total); /* concat them (may yield again) */ | ||
846 | } | ||
847 | break; | 846 | break; |
848 | } | 847 | } |
849 | default: { | 848 | default: { |