C/lua JSON and file bug reports

3 annoying things I found today.

  1. The Lua JSON decoder fails (reasonably) if you supply a path that doesn't exist. However, the error it gives in this circumstance is "You must supply a path or a file", which buries the actual error (e.g. that a directory in the path doesn't exist) making it very hard to diagnose.

  2. The C JSON decoder if passed NULL for a file gives an error about an unexpected character on line 1. It would be better if it reported that the input pointer is NULL.

  3. The C docs for playdate->file->open say that it is functionally equivalent to the lua playdate.file.open but this is not true - the lua version searches in the data folder first, and then the pdx, while the C version seraches only in the pdx or the data folder depending on the file mode input parameter.

That’s not true, you can pass both flags at once to look in both locations: pd->file->open(path, kFileRead|kFileReadData);

1 Like