|
@@ -23,6 +23,7 @@
|
|
|
#include "lj_state.h"
|
|
|
#include "lj_ff.h"
|
|
|
#include "lj_lib.h"
|
|
|
+#include "lj_strscan.h"
|
|
|
|
|
|
/* Userdata payload for I/O file. */
|
|
|
typedef struct IOFileUD {
|
|
@@ -324,13 +325,14 @@ LJLIB_CF(io_method_seek)
|
|
|
FILE *fp = io_tofile(L)->fp;
|
|
|
int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end");
|
|
|
int64_t ofs = 0;
|
|
|
- cTValue *o;
|
|
|
+ TValue *o;
|
|
|
int res;
|
|
|
if (opt == 0) opt = SEEK_SET;
|
|
|
else if (opt == 1) opt = SEEK_CUR;
|
|
|
else if (opt == 2) opt = SEEK_END;
|
|
|
o = L->base+2;
|
|
|
if (o < L->top) {
|
|
|
+ if (tvisstr(o)) lj_strscan_num(strV(o), o);
|
|
|
if (tvisint(o))
|
|
|
ofs = (int64_t)intV(o);
|
|
|
else if (tvisnum(o))
|