Return nil when indexing screen by number
This commit is contained in:
parent
20b1594e17
commit
5d2d296e20
|
@ -229,8 +229,11 @@ luaA_checkscreen(lua_State *L, int sidx)
|
||||||
{
|
{
|
||||||
int screen = lua_tointeger(L, sidx);
|
int screen = lua_tointeger(L, sidx);
|
||||||
if(screen < 1 || screen > globalconf.screens.len)
|
if(screen < 1 || screen > globalconf.screens.len)
|
||||||
luaL_error(L, "invalid screen number: %d (of %d existing)",
|
{
|
||||||
screen, globalconf.screens.len);
|
luaA_warn(L, "invalid screen number: %d (of %d existing)", screen, globalconf.screens.len);
|
||||||
|
lua_pushnil(L);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return globalconf.screens.tab[screen - 1];
|
return globalconf.screens.tab[screen - 1];
|
||||||
} else
|
} else
|
||||||
return luaA_checkudata(L, sidx, &screen_class);
|
return luaA_checkudata(L, sidx, &screen_class);
|
||||||
|
|
Loading…
Reference in New Issue