luaA_checkscreen: display number of existing screens with error

This is meant to be helpful in the case of 0 existing screens, e.g.
during executing the config initially.
This commit is contained in:
Daniel Hahler 2016-04-04 20:04:19 +02:00
parent e24cb901cb
commit 449974ca61
1 changed files with 2 additions and 1 deletions

View File

@ -107,7 +107,8 @@ luaA_checkscreen(lua_State *L, int sidx)
{
int screen = lua_tointeger(L, sidx);
if(screen < 1 || screen > globalconf.screens.len)
luaL_error(L, "invalid screen number: %d", screen);
luaL_error(L, "invalid screen number: %d (of %d existing)",
screen, globalconf.screens.len);
return globalconf.screens.tab[screen - 1];
} else
return luaA_checkudata(L, sidx, &screen_class);