1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add core.open_url() to main menu API (#8592)

This commit is contained in:
rubenwardy 2020-05-17 19:09:10 +01:00 committed by GitHub
parent c1ce4be756
commit a9c3a42323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 98 additions and 96 deletions

View file

@ -1063,6 +1063,14 @@ int ModApiMainMenu::l_get_max_supp_proto(lua_State *L)
return 1;
}
/******************************************************************************/
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)
{
@ -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);
}

View file

@ -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);