diff --git a/includes/luaconsole.h b/includes/luaconsole.h index dc320ad13..de33a04a3 100644 --- a/includes/luaconsole.h +++ b/includes/luaconsole.h @@ -77,4 +77,5 @@ int luatpt_setdebug(lua_State* l); int luatpt_setfpscap(lua_State* l); int luatpt_getscript(lua_State* l); int luatpt_setwindowsize(lua_State* l); +int luatpt_screenshot(lua_State* l); #endif diff --git a/src/luaconsole.c b/src/luaconsole.c index 5cc2bb3f1..c74155b27 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -65,6 +65,7 @@ void luacon_open(){ {"getscript",&luatpt_getscript}, {"setwindowsize",&luatpt_setwindowsize}, {"watertest",&luatpt_togglewater}, + {"screenshot",&luatpt_screenshot}, {NULL,NULL} }; @@ -1123,9 +1124,9 @@ int luatpt_setdebug(lua_State* l) } int luatpt_setfpscap(lua_State* l) { -int fpscap = luaL_optint(l, 1, 0); -limitFPS = fpscap; -return 0; + int fpscap = luaL_optint(l, 1, 0); + limitFPS = fpscap; + return 0; } int luatpt_getscript(lua_State* l) { @@ -1225,4 +1226,22 @@ int luatpt_setwindowsize(lua_State* l) return 1; } +int luatpt_screenshot(lua_State* l) +{ + int captureUI = luaL_optint(l, 1, 0); + if(vid_buf) + { + if(captureUI) + { + dump_frame(vid_buf, XRES+BARSIZE, YRES+MENUSIZE, XRES+BARSIZE); + } + else + { + dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); + } + return 0; + } + return luaL_error(l, "Screen buffer does not exist"); +} + #endif