From cbcb1b1a9ff9203869eb5458dc2d4b09f3f21ebb Mon Sep 17 00:00:00 2001 From: dnc40085 Date: Fri, 18 May 2018 22:08:42 -0700 Subject: [PATCH] Fixed lack of nil return in file.read() when EOF is reached --- app/modules/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/modules/file.c b/app/modules/file.c index 670fab89..26a91d94 100644 --- a/app/modules/file.c +++ b/app/modules/file.c @@ -432,7 +432,8 @@ static int file_g_read( lua_State* L, int n, int16_t end_char, int fd ) luaM_free(L, heap_mem); heap_mem = NULL; } - return 0; + lua_pushnil(L); + return 1; } vfs_lseek(fd, -(n - i), VFS_SEEK_CUR);