aboutsummaryrefslogtreecommitdiff
path: root/src/shared/lua_api/stream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/lua_api/stream.cpp')
-rw-r--r--src/shared/lua_api/stream.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/lua_api/stream.cpp b/src/shared/lua_api/stream.cpp
index 3ec2394..9f7200c 100644
--- a/src/shared/lua_api/stream.cpp
+++ b/src/shared/lua_api/stream.cpp
@@ -25,7 +25,7 @@ int stream_readInt(struct stream* s){
s->read += sizeof(int);
return *ptr;
}
-void stream_writeData(struct stream* s, const char* d, int len){
+void stream_writeData(struct stream* s, const char* d, size_t len){
long o = s->length;
s->length += sizeof(char)*len;
s->data = (byte*)realloc(s->data,s->length);
@@ -53,6 +53,11 @@ void stream_writeDouble(struct stream* s, double number){
double* ptr = (double*)(s->data + o);
*ptr = number;
}
+double stream_readDouble(struct stream* s){
+ double *ptr = (double*)(s->data + s->read);
+ s->read += sizeof(double);
+ return *ptr;
+}
void stream_print(struct stream* s){
printf("Length:%ld\nRead:%ld\nData starts at %p\nData:",s->length, s->read, s->data);