aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-05-17 19:09:10 +0100
committerGitHub <noreply@github.com>2020-05-17 19:09:10 +0100
commita9c3a423231e26ea3edee51d5f0bf949ca8e529b (patch)
treebaac0b68f1d2daf66a140dc15d6d731eba64c9dc /src/script
parentc1ce4be756e2554051a27f244303377c0a7d69a6 (diff)
downloadminetest-a9c3a423231e26ea3edee51d5f0bf949ca8e529b.tar.gz
minetest-a9c3a423231e26ea3edee51d5f0bf949ca8e529b.tar.bz2
minetest-a9c3a423231e26ea3edee51d5f0bf949ca8e529b.zip
Add core.open_url() to main menu API (#8592)
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp9
-rw-r--r--src/script/lua_api/l_mainmenu.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index a76e9f079..f32c477c2 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -1064,6 +1064,14 @@ int ModApiMainMenu::l_get_max_supp_proto(lua_State *L)
}
/******************************************************************************/
+int ModApiMainMenu::l_open_url(lua_State *L)
+{
+ std::string url = luaL_checkstring(L, 1);
+ lua_pushboolean(L, porting::openURL(url));
+ return 1;
+}
+
+/******************************************************************************/
int ModApiMainMenu::l_do_async_callback(lua_State *L)
{
GUIEngine* engine = getGuiEngine(L);
@@ -1125,6 +1133,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_screen_info);
API_FCT(get_min_supp_proto);
API_FCT(get_max_supp_proto);
+ API_FCT(open_url);
API_FCT(do_async_callback);
}
diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h
index b2ca49320..5a16b3bfe 100644
--- a/src/script/lua_api/l_mainmenu.h
+++ b/src/script/lua_api/l_mainmenu.h
@@ -145,6 +145,9 @@ private:
static int l_get_max_supp_proto(lua_State *L);
+ // other
+ static int l_open_url(lua_State *L);
+
// async
static int l_do_async_callback(lua_State *L);