author | unc0rr |
Sat, 17 Nov 2012 00:15:30 +0400 | |
branch | physfslayer |
changeset 8040 | 448d61778ca7 |
parent 8034 | fc032c0f7b23 |
child 8073 | 5a289ef40fdb |
permissions | -rw-r--r-- |
8040 | 1 |
#include <lua.h> |
8034 | 2 |
#include <physfs.h> |
3 |
||
4 |
#define BUFSIZE 1024 |
|
5 |
||
6 |
void * physfsReaderBuffer; |
|
7 |
||
8 |
const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size) |
|
9 |
{ |
|
10 |
||
11 |
if(PHYSFS_eof(f)) |
|
12 |
{ |
|
13 |
return NULL; |
|
14 |
} |
|
15 |
else |
|
16 |
{ |
|
17 |
*size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE); |
|
18 |
||
19 |
if(*size == 0) |
|
20 |
return NULL; |
|
21 |
else |
|
22 |
return physfsReaderBuffer; |
|
23 |
} |
|
24 |
} |