return fd;
}
+static int nixio_strerror(lua_State *L) {
+ lua_pushstring(L, strerror(luaL_checkinteger(L, 1)));
+ return 1;
+}
+
/* object table */
static const luaL_reg R[] = {
+ {"strerror", nixio_strerror},
{NULL, NULL}
};
/* register metatable as socket_meta */
lua_pushvalue(L, -2);
- lua_setfield(L, -2, "socket_meta");
+ lua_setfield(L, -2, "meta_socket");
/* register methods */
nixio_open_file(L);
lua_setfield(L, -2, "version");
/* some constants */
- lua_createtable(L, 0, 1);
+ lua_createtable(L, 0, 7);
NIXIO_PUSH_CONSTANT(EACCES);
NIXIO_PUSH_CONSTANT(ENOSYS);
NIXIO_PUSH_CONSTANT(EWOULDBLOCK);
NIXIO_PUSH_CONSTANT(EAGAIN);
NIXIO_PUSH_CONSTANT(ENOMEM);
+ NIXIO_PUSH_CONSTANT(ENOENT);
lua_setfield(L, -2, "const");