summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-02-24 21:30:14 +0100
committerAki <please@ignore.pl>2021-02-24 21:30:14 +0100
commit87d97759fbe62be67ad26f55600715c0f426f542 (patch)
tree88b92ead42c25dcd229beba0fca938cbd249780e
parentd64871855128af6fa41a8c089686552ca1b66c70 (diff)
downloadplop-87d97759fbe62be67ad26f55600715c0f426f542.zip
plop-87d97759fbe62be67ad26f55600715c0f426f542.tar.gz
plop-87d97759fbe62be67ad26f55600715c0f426f542.tar.bz2
Added read continuation function
-rw-r--r--stream.c11
-rw-r--r--stream.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/stream.c b/stream.c
index 7700365..f9cdb6d 100644
--- a/stream.c
+++ b/stream.c
@@ -91,5 +91,16 @@ int stream_read(lua_State * L)
s->in.data = buffer;
}
+ return stream_readk(L, LUA_OK, 0); // Intentionally do not pop Stream that's on top of the stack.
+}
+
+/// Continuation function and core implementation of the reading operation from a stream.
+/// \param L Lua state running reading operation
+/// \param status TODO
+/// \param ctx TODO
+/// \param Number of the results pushed to the stack
+int stream_readk(lua_State * L, int status, lua_KContext ctx)
+{
+ lua_pop(L, 0);
return 0;
}
diff --git a/stream.h b/stream.h
index efa6afa..c4bb3ef 100644
--- a/stream.h
+++ b/stream.h
@@ -18,3 +18,4 @@ struct stream
int stream_push_new(lua_State *, const int);
int stream_gc(lua_State *);
int stream_read(lua_State *);
+int stream_readk(lua_State *, const int, lua_KContext);