blob: d6a525439c5e6f60fa1d9e1073e3d033e4f887eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "stream.h"
#include <lauxlib.h>
#include <lua.h>
/// Creates and pushes new Stream into the Lua stack.
/// \param L Lua state to push to
/// \param fd File descriptor used by stream
/// \return TODO
int stream_push_new(lua_State * L, const int fd)
{
struct stream * s = lua_newuserdata(L, sizeof(struct stream));
s->fd = fd;
if (1 == luaL_newmetatable(L, "stream"))
{
// TODO: initialize metatable for stream
}
lua_setmetatable(L, -2);
return LUA_OK;
}
|