From 4f9797b6e87f62050863f5b17917603290f260c4 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 27 Oct 2020 15:20:32 +0100 Subject: lua api: add core.take_screenshot() --- src/script/lua_api/l_client.cpp | 10 ++++++++++ src/script/lua_api/l_client.h | 3 +++ 2 files changed, 13 insertions(+) (limited to 'src/script/lua_api') diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp index 9961471ff..05bfcca52 100644 --- a/src/script/lua_api/l_client.cpp +++ b/src/script/lua_api/l_client.cpp @@ -524,6 +524,14 @@ int ModApiClient::l_get_objects_inside_radius(lua_State *L) return 1; } +//take_screenshot() +int ModApiClient::l_take_screenshot(lua_State *L) +{ + getClient(L)->makeScreenshot(); + lua_pushboolean(L, true); + return 1; +} + void ModApiClient::Initialize(lua_State *L, int top) { API_FCT(get_current_modname); @@ -558,4 +566,6 @@ void ModApiClient::Initialize(lua_State *L, int top) API_FCT(set_keypress); API_FCT(drop_selected_item); API_FCT(get_objects_inside_radius); + API_FCT(take_screenshot); + } diff --git a/src/script/lua_api/l_client.h b/src/script/lua_api/l_client.h index 5863e5717..04cc23041 100644 --- a/src/script/lua_api/l_client.h +++ b/src/script/lua_api/l_client.h @@ -126,6 +126,9 @@ private: // get_objects_inside_radius(pos, radius) static int l_get_objects_inside_radius(lua_State *L); + //take_screenshot() + static int l_take_screenshot(lua_State *L); + public: static void Initialize(lua_State *L, int top); }; -- cgit v1.2.3