| ** See Copyright Notice in lua.h |
| buff = z->reader(L, z->data, &size); |
| if (buff == NULL || size == 0) |
| z->n = size - 1; /* discount char being returned */ |
| return cast_uchar(*(z->p++)); |
| void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { |
| /* --------------------------------------------------------------- read --- */ |
| size_t luaZ_read (ZIO *z, void *b, size_t n) { |
| if (z->n == 0) { /* no bytes in buffer? */ |
| if (luaZ_fill(z) == EOZ) /* try to read more */ |
| return n; /* no more input; return number of missing bytes */ |
| z->n++; /* luaZ_fill consumed first byte; put it back */ |
| m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ |