fix client_focused()
[wmiirc-lua.git] / luaeventloop / lel_util.c
blob91511d16cef348bad58c90caede4acfc4a03dfa3
1 #include <stdio.h>
2 #include <string.h>
3 #include <errno.h>
4 #include <time.h>
6 #include <lua.h>
7 #include <lauxlib.h>
9 #include "lel_util.h"
12 /* ------------------------------------------------------------------------
13 * error helper
15 int lel_pusherror(lua_State *L, const char *info)
17 lua_pushnil(L);
18 if (info==NULL) {
19 lua_pushstring(L, strerror(errno));
20 lua_pushnumber(L, errno);
21 return 3;
22 } else if (errno) {
23 lua_pushfstring(L, "%s: %s", info, strerror(errno));
24 lua_pushnumber(L, errno);
25 return 3;
26 } else {
27 lua_pushfstring(L, "%s", info);
28 return 2;