aboutsummaryrefslogtreecommitdiff
path: root/src/lib_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib_io.c')
-rw-r--r--src/lib_io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib_io.c b/src/lib_io.c
index 4e0397d4..5659ff51 100644
--- a/src/lib_io.c
+++ b/src/lib_io.c
@@ -25,6 +25,7 @@
25#include "lj_strfmt.h" 25#include "lj_strfmt.h"
26#include "lj_ff.h" 26#include "lj_ff.h"
27#include "lj_lib.h" 27#include "lj_lib.h"
28#include "lj_strscan.h"
28 29
29/* Userdata payload for I/O file. */ 30/* Userdata payload for I/O file. */
30typedef struct IOFileUD { 31typedef struct IOFileUD {
@@ -323,13 +324,14 @@ LJLIB_CF(io_method_seek)
323 FILE *fp = io_tofile(L)->fp; 324 FILE *fp = io_tofile(L)->fp;
324 int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end"); 325 int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end");
325 int64_t ofs = 0; 326 int64_t ofs = 0;
326 cTValue *o; 327 TValue *o;
327 int res; 328 int res;
328 if (opt == 0) opt = SEEK_SET; 329 if (opt == 0) opt = SEEK_SET;
329 else if (opt == 1) opt = SEEK_CUR; 330 else if (opt == 1) opt = SEEK_CUR;
330 else if (opt == 2) opt = SEEK_END; 331 else if (opt == 2) opt = SEEK_END;
331 o = L->base+2; 332 o = L->base+2;
332 if (o < L->top) { 333 if (o < L->top) {
334 if (tvisstr(o)) lj_strscan_num(strV(o), o);
333 if (tvisint(o)) 335 if (tvisint(o))
334 ofs = (int64_t)intV(o); 336 ofs = (int64_t)intV(o);
335 else if (tvisnum(o)) 337 else if (tvisnum(o))