Navigation Menu

Skip to content

Commit

Permalink
Lua 5.3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
piernov committed Aug 2, 2015
1 parent 458165b commit eaeeb68
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions child_lua_ev.c
Expand Up @@ -2,7 +2,7 @@
#include <sys/wait.h>
#endif

#define luaL_checkbool(L, i) (lua_isboolean(L, i) ? lua_toboolean(L, i) : luaL_checkint(L, i))
#define luaL_checkbool(L, i) (lua_isboolean(L, i) ? lua_toboolean(L, i) : (int)luaL_checkinteger(L, i))

/**
* Create a table for ev.CHILD that gives access to the constructor for
Expand Down Expand Up @@ -55,7 +55,7 @@ static int create_child_mt(lua_State *L) {
* [+1, -0, ?]
*/
static int child_new(lua_State* L) {
int pid = luaL_checkint(L, 2);
int pid = (int)luaL_checkinteger(L, 2);
int trace = luaL_checkbool(L, 3);
ev_child* child;

Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/FindLua5X.cmake
Expand Up @@ -2,7 +2,7 @@
find_path(LUA_INCLUDE_DIR lua.h
HINTS
$ENV{LUA_DIR}
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua include include/lua51 include/lua5.1
PATH_SUFFIXES include include/lua include/lua53 include/lua5.3 include/lua52 include/lua5.2 include/lua51 include/lua5.1
PATHS
~/Library/Frameworks
/Library/Frameworks
Expand All @@ -15,7 +15,7 @@ find_path(LUA_INCLUDE_DIR lua.h
)

find_library(LUA_LIBRARY
NAMES lua52 lua5.2 lua-5.2 lua lua51 lua5.1 luajit-5.1 luajit51 luajit5.1
NAMES lua lua53 lua5.3 lua52 lua5.2 lua-5.2 lua51 lua5.1 luajit-5.1 luajit51 luajit5.1
HINTS
$ENV{LUA_DIR}
PATH_SUFFIXES lib64 lib
Expand Down
4 changes: 2 additions & 2 deletions io_lua_ev.c
Expand Up @@ -46,8 +46,8 @@ static int create_io_mt(lua_State *L) {
* [+1, -0, ?]
*/
static int io_new(lua_State* L) {
int fd = luaL_checkint(L, 2);
int events = luaL_checkint(L, 3);
int fd = (int)luaL_checkinteger(L, 2);
int events = (int)luaL_checkinteger(L, 3);
ev_io* io;

io = watcher_new(L, sizeof(ev_io), IO_MT);
Expand Down
2 changes: 1 addition & 1 deletion signal_lua_ev.c
Expand Up @@ -44,7 +44,7 @@ static int create_signal_mt(lua_State *L) {
* [+1, -0, ?]
*/
static int signal_new(lua_State* L) {
int signum = luaL_checkint(L, 2);
int signum = (int)luaL_checkinteger(L, 2);
ev_signal* sig;

sig = watcher_new(L, sizeof(ev_signal), SIGNAL_MT);
Expand Down
2 changes: 1 addition & 1 deletion stat_lua_ev.c
Expand Up @@ -47,7 +47,7 @@ static int create_stat_mt(lua_State *L) {
*/
static int stat_new(lua_State* L) {
const char* path = luaL_checkstring(L, 2);
ev_tstamp interval = luaL_optint(L, 3, 0);
ev_tstamp interval = (int)luaL_optinteger(L, 3, 0);
ev_stat* stat;

stat = watcher_new(L, sizeof(ev_stat), STAT_MT);
Expand Down
2 changes: 1 addition & 1 deletion watcher_lua_ev.c
Expand Up @@ -219,7 +219,7 @@ static int watcher_priority(lua_State *L) {
ev_watcher *w = check_watcher(L, 1);
int old_pri = ev_priority(w);

if ( has_pri ) ev_set_priority(w, luaL_checkint(L, 2));
if ( has_pri ) ev_set_priority(w, (int)luaL_checkinteger(L, 2));
lua_pushinteger(L, old_pri);
return 1;
}

0 comments on commit eaeeb68

Please sign in to comment.