(L *LState)
| 41 | } |
| 42 | |
| 43 | func strByte(L *LState) int { |
| 44 | str := L.CheckString(1) |
| 45 | start := L.OptInt(2, 1) - 1 |
| 46 | end := L.OptInt(3, -1) |
| 47 | l := len(str) |
| 48 | if start < 0 { |
| 49 | start = l + start + 1 |
| 50 | } |
| 51 | if end < 0 { |
| 52 | end = l + end + 1 |
| 53 | } |
| 54 | |
| 55 | if L.GetTop() == 2 { |
| 56 | if start < 0 || start >= l { |
| 57 | return 0 |
| 58 | } |
| 59 | L.Push(LNumber(str[start])) |
| 60 | return 1 |
| 61 | } |
| 62 | |
| 63 | start = intMax(start, 0) |
| 64 | end = intMin(end, l) |
| 65 | if end < 0 || end <= start || start >= l { |
| 66 | return 0 |
| 67 | } |
| 68 | |
| 69 | for i := start; i < end; i++ { |
| 70 | L.Push(LNumber(str[i])) |
| 71 | } |
| 72 | return end - start |
| 73 | } |
| 74 | |
| 75 | func strChar(L *LState) int { |
| 76 | top := L.GetTop() |
nothing calls this directly
no test coverage detected
searching dependent graphs…