From 745e758394e8b6e6118c920b79d333c73f5470ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Fri, 28 Oct 2016 03:53:26 +0200 Subject: [PATCH] degesch: add Lua API for screen size retrieval --- degesch.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/degesch.c b/degesch.c index 8b1ee4e..828857f 100644 --- a/degesch.c +++ b/degesch.c @@ -9806,6 +9806,14 @@ lua_plugin_connect (lua_State *L) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +static int +lua_plugin_get_screen_size (lua_State *L) +{ + lua_pushinteger (L, g_terminal.lines); + lua_pushinteger (L, g_terminal.columns); + return 2; +} + static int lua_ctx_gc (lua_State *L) { @@ -9826,8 +9834,9 @@ static luaL_Reg lua_plugin_library[] = { "connect", lua_plugin_connect }, // And these are methods: + + { "get_screen_size", lua_plugin_get_screen_size }, { "__gc", lua_ctx_gc }, - // TODO: get_prompt_ignore_markers() { NULL, NULL }, };