(L *LState, total, last int)
| 2344 | } |
| 2345 | |
| 2346 | func stringConcat(L *LState, total, last int) LValue { |
| 2347 | rhs := L.reg.Get(last) |
| 2348 | total-- |
| 2349 | for i := last - 1; total > 0; { |
| 2350 | lhs := L.reg.Get(i) |
| 2351 | if !(LVCanConvToString(lhs) && LVCanConvToString(rhs)) { |
| 2352 | op := L.metaOp2(lhs, rhs, "__concat") |
| 2353 | if op.Type() == LTFunction { |
| 2354 | L.reg.Push(op) |
| 2355 | L.reg.Push(lhs) |
| 2356 | L.reg.Push(rhs) |
| 2357 | L.Call(2, 1) |
| 2358 | rhs = L.reg.Pop() |
| 2359 | total-- |
| 2360 | i-- |
| 2361 | } else { |
| 2362 | L.RaiseError("cannot perform concat operation between %v and %v", lhs.Type().String(), rhs.Type().String()) |
| 2363 | return LNil |
| 2364 | } |
| 2365 | } else { |
| 2366 | buf := make([]string, total+1) |
| 2367 | buf[total] = LVAsString(rhs) |
| 2368 | for total > 0 { |
| 2369 | lhs = L.reg.Get(i) |
| 2370 | if !LVCanConvToString(lhs) { |
| 2371 | break |
| 2372 | } |
| 2373 | buf[total-1] = LVAsString(lhs) |
| 2374 | i-- |
| 2375 | total-- |
| 2376 | } |
| 2377 | rhs = LString(strings.Join(buf, "")) |
| 2378 | } |
| 2379 | } |
| 2380 | return rhs |
| 2381 | } |
| 2382 | |
| 2383 | func lessThan(L *LState, lhs, rhs LValue) bool { |
| 2384 | // optimization for numbers |
no test coverage detected
searching dependent graphs…