diff options
author | Mike Pall <mike> | 2012-09-28 17:54:18 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-09-28 17:54:18 +0200 |
commit | 7a6bb9a20836107cd715a818072cbbd1c8eac516 (patch) | |
tree | f23c482d298e49a929b66474d2850d8bbc3d12f2 /src/lib_io.c | |
parent | 26841296ab9e5f6d5df1a720e185334d5e84936b (diff) | |
download | luajit-7a6bb9a20836107cd715a818072cbbd1c8eac516.tar.gz luajit-7a6bb9a20836107cd715a818072cbbd1c8eac516.tar.bz2 luajit-7a6bb9a20836107cd715a818072cbbd1c8eac516.zip |
From Lua 5.2: Return file object for io.write() and file:write().
Needs -DLUAJIT_ENABLE_LUA52COMPAT.
Diffstat (limited to 'src/lib_io.c')
-rw-r--r-- | src/lib_io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib_io.c b/src/lib_io.c index 142bfae5..e0762297 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
@@ -244,6 +244,12 @@ static int io_file_write(lua_State *L, FILE *fp, int start) | |||
244 | lj_err_argt(L, (int)(tv - L->base) + 1, LUA_TSTRING); | 244 | lj_err_argt(L, (int)(tv - L->base) + 1, LUA_TSTRING); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | if (LJ_52 && status) { | ||
248 | L->top = L->base+1; | ||
249 | if (start == 0) | ||
250 | setudataV(L, L->base, IOSTDF_UD(L, GCROOT_IO_OUTPUT)); | ||
251 | return 1; | ||
252 | } | ||
247 | return luaL_fileresult(L, status, NULL); | 253 | return luaL_fileresult(L, status, NULL); |
248 | } | 254 | } |
249 | 255 | ||