| 1082 | } |
| 1083 | |
| 1084 | static int Lslice_enter(lua_State *L) { |
| 1085 | lpb_Slice *s = check_lslice(L, 1); |
| 1086 | pb_Slice view; |
| 1087 | if (lua_isnoneornil(L, 2)) { |
| 1088 | argcheck(L, pb_readbytes(&s->curr, &view) != 0, |
| 1089 | 1, "bytes wireformat expected at offset %d", pb_pos(s->curr)+1); |
| 1090 | view.start = view.p; |
| 1091 | lpb_enterview(L, s, view); |
| 1092 | } else { |
| 1093 | lua_Integer r[] = {1, -1}; |
| 1094 | lua_Integer range = rangerelat(L, 2, r, pb_len(s->curr)); |
| 1095 | view.p = s->curr.start + r[0] - 1; |
| 1096 | view.end = view.p + range; |
| 1097 | view.start = s->curr.p; |
| 1098 | lpb_enterview(L, s, view); |
| 1099 | } |
| 1100 | return_self(L); |
| 1101 | } |
| 1102 | |
| 1103 | static int Lslice_leave(lua_State *L) { |
| 1104 | lpb_Slice *s = check_lslice(L, 1); |
nothing calls this directly
no test coverage detected