summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--src/liolib.js14
2 files changed, 16 insertions, 2 deletions
diff --git a/README.md b/README.md
index 6d94e2e..4b78239 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,7 @@
- [x] Package
- [ ] io
- [x] `file:__tostring()`
+ - [x] `file:flush()`
- [x] `file:write()`
- [x] `io.close()`
- [x] `io.stderr`
@@ -36,7 +37,7 @@
- [x] `io.stdout`
- [x] `io.type()`
- [x] `io.write()`
- - [ ] `io.flush()`
+ - [x] `io.flush()`
- [ ] `io.input()`
- [ ] `io.lines()`
- [ ] `io.open()`
@@ -44,7 +45,6 @@
- [ ] `io.popen()`
- [ ] `io.read()`
- [ ] `io.tmpfile()`
- - [ ] `file:flush()`
- [ ] `file:lines()`
- [ ] `file:read()`
- [ ] `file:setvbuf()`
diff --git a/src/liolib.js b/src/liolib.js
index 575b3ec..6c7d945 100644
--- a/src/liolib.js
+++ b/src/liolib.js
@@ -105,14 +105,28 @@ const f_write = function(L) {
return g_write(L, f, 2);
};
+const io_flush = function (L) {
+ /* stub, as node doesn't have synchronized buffered IO */
+ getiofile(L, IO_OUTPUT);
+ return lauxlib.luaL_fileresult(L, true, null, null);
+};
+
+const f_flush = function (L) {
+ /* stub, as node doesn't have synchronized buffered IO */
+ tofile(L);
+ return lauxlib.luaL_fileresult(L, true, null, null);
+};
+
const iolib = {
"close": io_close,
+ "flush": io_flush,
"type": io_type,
"write": io_write
};
const flib = {
"close": io_close,
+ "flush": f_flush,
"write": f_write,
"__tostring": f_tostring
};