[lua] Fix gettop() usages

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-10 20:32:26 +02:00
parent 1ca55927f0
commit f11c913bc4
3 changed files with 5 additions and 4 deletions

View File

@ -1288,7 +1288,7 @@ luaA_client_titlebar_set(lua_State *L)
client_t **c = luaA_checkudata(L, 1, "client"); client_t **c = luaA_checkudata(L, 1, "client");
titlebar_t **t = NULL; titlebar_t **t = NULL;
if(lua_gettop(L) == 2) if(lua_gettop(L) == 2 && !lua_isnil(L, 2))
{ {
t = luaA_checkudata(L, 2, "titlebar"); t = luaA_checkudata(L, 2, "titlebar");
if(client_getbytitlebar(*t)) if(client_getbytitlebar(*t))

3
lua.c
View File

@ -393,8 +393,9 @@ luaA_hooks_timer(lua_State *L)
globalconf.timer.tv_usec = 0; globalconf.timer.tv_usec = 0;
globalconf.timer.tv_sec = luaL_checknumber(L, 1); globalconf.timer.tv_sec = luaL_checknumber(L, 1);
if(lua_gettop(L) == 2 && lua_isfunction(L, 2)) if(lua_gettop(L) == 2 && !lua_isnil(L, 2))
{ {
luaA_checkfunction(L, 2);
if(globalconf.hooks.timer) if(globalconf.hooks.timer)
luaL_unref(L, LUA_REGISTRYINDEX, globalconf.hooks.timer); luaL_unref(L, LUA_REGISTRYINDEX, globalconf.hooks.timer);
globalconf.hooks.timer = luaL_ref(L, LUA_REGISTRYINDEX); globalconf.hooks.timer = luaL_ref(L, LUA_REGISTRYINDEX);

View File

@ -749,8 +749,8 @@ luaA_client_mouse_resize(lua_State *L)
client_t **c = luaA_checkudata(L, 1, "client"); client_t **c = luaA_checkudata(L, 1, "client");
corner_t corner = AutoCorner; corner_t corner = AutoCorner;
if(lua_gettop(L) == 2 && lua_isstring(L, 2)) if(lua_gettop(L) == 2)
corner = a_strtocorner(lua_tostring(L, 2)); corner = a_strtocorner(luaL_checkstring(L, 2));
mouse_client_resize(*c, corner); mouse_client_resize(*c, corner);
return 0; return 0;