(L *LState)
| 50 | } |
| 51 | |
| 52 | func tableConcat(L *LState) int { |
| 53 | tbl := L.CheckTable(1) |
| 54 | sep := LString(L.OptString(2, "")) |
| 55 | i := L.OptInt(3, 1) |
| 56 | j := L.OptInt(4, tbl.Len()) |
| 57 | if L.GetTop() == 3 { |
| 58 | if i > tbl.Len() || i < 1 { |
| 59 | L.Push(emptyLString) |
| 60 | return 1 |
| 61 | } |
| 62 | } |
| 63 | i = intMax(intMin(i, tbl.Len()), 1) |
| 64 | j = intMin(intMin(j, tbl.Len()), tbl.Len()) |
| 65 | if i > j { |
| 66 | L.Push(emptyLString) |
| 67 | return 1 |
| 68 | } |
| 69 | //TODO should flushing? |
| 70 | retbottom := L.GetTop() |
| 71 | for ; i <= j; i++ { |
| 72 | v := tbl.RawGetInt(i) |
| 73 | if !LVCanConvToString(v) { |
| 74 | L.RaiseError("invalid value (%s) at index %d in table for concat", v.Type().String(), i) |
| 75 | } |
| 76 | L.Push(v) |
| 77 | if i != j { |
| 78 | L.Push(sep) |
| 79 | } |
| 80 | } |
| 81 | L.Push(stringConcat(L, L.GetTop()-retbottom, L.reg.Top()-1)) |
| 82 | return 1 |
| 83 | } |
| 84 | |
| 85 | func tableInsert(L *LState) int { |
| 86 | tbl := L.CheckTable(1) |
nothing calls this directly
no test coverage detected
searching dependent graphs…