(L *LState, total, last int)
| 928 | } |
| 929 | |
| 930 | func stringConcat(L *LState, total, last int) LValue { |
| 931 | rhs := L.reg.Get(last) |
| 932 | total-- |
| 933 | for i := last - 1; total > 0; { |
| 934 | lhs := L.reg.Get(i) |
| 935 | if !(LVCanConvToString(lhs) && LVCanConvToString(rhs)) { |
| 936 | op := L.metaOp2(lhs, rhs, "__concat") |
| 937 | if op.Type() == LTFunction { |
| 938 | L.reg.Push(op) |
| 939 | L.reg.Push(lhs) |
| 940 | L.reg.Push(rhs) |
| 941 | L.Call(2, 1) |
| 942 | rhs = L.reg.Pop() |
| 943 | total-- |
| 944 | i-- |
| 945 | } else { |
| 946 | L.RaiseError("cannot perform concat operation between %v and %v", lhs.Type().String(), rhs.Type().String()) |
| 947 | return LNil |
| 948 | } |
| 949 | } else { |
| 950 | buf := make([]string, total+1) |
| 951 | buf[total] = LVAsString(rhs) |
| 952 | for total > 0 { |
| 953 | lhs = L.reg.Get(i) |
| 954 | if !LVCanConvToString(lhs) { |
| 955 | break |
| 956 | } |
| 957 | buf[total-1] = LVAsString(lhs) |
| 958 | i-- |
| 959 | total-- |
| 960 | } |
| 961 | rhs = LString(strings.Join(buf, "")) |
| 962 | } |
| 963 | } |
| 964 | return rhs |
| 965 | } |
| 966 | |
| 967 | func lessThan(L *LState, lhs, rhs LValue) bool { |
| 968 | // optimization for numbers |
no test coverage detected
searching dependent graphs…