| 12322 | |
| 12323 | |
| 12324 | static int g_write (lua_State *L, FILE *f, int arg) { |
| 12325 | int nargs = lua_gettop(L) - 1; |
| 12326 | int status = 1; |
| 12327 | for (; nargs--; arg++) { |
| 12328 | if (lua_type(L, arg) == LUA_TNUMBER) { |
| 12329 | /* optimization: could be done exactly as for strings */ |
| 12330 | status = status && |
| 12331 | fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; |
| 12332 | } |
| 12333 | else { |
| 12334 | size_t l; |
| 12335 | const char *s = luaL_checklstring(L, arg, &l); |
| 12336 | status = status && (fwrite(s, sizeof(char), l, f) == l); |
| 12337 | } |
| 12338 | } |
| 12339 | return pushresult(L, status, NULL); |
| 12340 | } |
| 12341 | |
| 12342 | |
| 12343 | static int io_write (lua_State *L) { |
no test coverage detected