diff --git a/tablelib.go b/tablelib.go index f3f4607..0247431 100644 --- a/tablelib.go +++ b/tablelib.go @@ -66,19 +66,18 @@ func tableConcat(L *LState) int { L.Push(emptyLString) return 1 } - //TODO should flushing? - retbottom := L.GetTop() + result := "" for ; i <= j; i++ { v := tbl.RawGetInt(i) if !LVCanConvToString(v) { L.RaiseError("invalid value (%s) at index %d in table for concat", v.Type().String(), i) } - L.Push(v) + result += LVAsString(v) if i != j { - L.Push(sep) + result += LVAsString(sep) } } - L.Push(stringConcat(L, L.GetTop()-retbottom, L.reg.Top()-1)) + L.Push(LString(result)) return 1 }