Add some more extensions from Lua 5.2/5.3.

Contributed by François Perrad.
This commit is contained in:
Mike Pall
2017-01-17 11:37:28 +01:00
parent ed4ce98ac1
commit c198167690
7 changed files with 56 additions and 11 deletions

View File

@@ -203,13 +203,12 @@ static int io_file_read(lua_State *L, FILE *fp, int start)
for (n = start; nargs-- && ok; n++) {
if (tvisstr(L->base+n)) {
const char *p = strVdata(L->base+n);
if (p[0] != '*')
lj_err_arg(L, n+1, LJ_ERR_INVOPT);
if (p[1] == 'n')
if (p[0] == '*') p++;
if (p[0] == 'n')
ok = io_file_readnum(L, fp);
else if ((p[1] & ~0x20) == 'L')
ok = io_file_readline(L, fp, (p[1] == 'l'));
else if (p[1] == 'a')
else if ((p[0] & ~0x20) == 'L')
ok = io_file_readline(L, fp, (p[0] == 'l'));
else if (p[0] == 'a')
io_file_readall(L, fp);
else
lj_err_arg(L, n+1, LJ_ERR_INVFMT);