| 533 | } |
| 534 | |
| 535 | static int io_write(lua_State *L, FILE *f, int idx) { |
| 536 | int nargs = lua_gettop(L) - idx + 1; |
| 537 | int status = 1; |
| 538 | for (; nargs--; idx++) { |
| 539 | pb_Slice s = lpb_checkslice(L, idx); |
| 540 | size_t l = pb_len(s); |
| 541 | status = status && (fwrite(s.p, sizeof(char), l, f) == l); |
| 542 | } |
| 543 | return status ? 1 : luaL_fileresult(L, 0, NULL); |
| 544 | } |
| 545 | |
| 546 | static int Lio_read(lua_State *L) { |
| 547 | const char *fname = luaL_optstring(L, 1, NULL); |
no test coverage detected