aboutsummaryrefslogtreecommitdiff
path: root/src/shared/lua_api/stream.hpp
blob: bf44ed477d20d66c5684f597c49ad2aa5791285b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdlib.h>

//Char is not definitvely a byte, read the fucking standard
#define byte char

typedef struct stream {
	long length;
	byte* data;
	long read;
} stream;

struct stream* stream_create();

void stream_writeInt(struct stream* s, int number);
int stream_readInt(struct stream* s);

void stream_writeString(struct stream* s, const char* string, size_t len);
char* stream_readString(struct stream* s);

void stream_writeData(struct stream* s, const char* data, size_t len);
void stream_readData(struct stream* s, int len, char* out);

void stream_writeDouble(struct stream* s, double number);
double stream_readDouble(struct stream* s);

void stream_print(struct stream* s);

void stream_free(struct stream* s);