]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_mainmenu.cpp
Merge branch 'master' of https://github.com/minetest/minetest
[dragonfireclient.git] / src / script / lua_api / l_mainmenu.cpp
index 411250a0b17754fd6c2c9bfc4ead4a5fc5493bb4..c1530f0d3cec51c534683ac06c7e14ee03873c49 100644 (file)
@@ -139,6 +139,14 @@ int ModApiMainMenu::l_start(lua_State *L)
                data->password = getTextData(L,"password");
                data->address  = getTextData(L,"address");
                data->port     = getTextData(L,"port");
+
+               const auto val = getTextData(L, "allow_login_or_register");
+               if (val == "login")
+                       data->allow_login_or_register = ELoginRegister::Login;
+               else if (val == "register")
+                       data->allow_login_or_register = ELoginRegister::Register;
+               else
+                       data->allow_login_or_register = ELoginRegister::Any;
        }
        data->serverdescription = getTextData(L,"serverdescription");
        data->servername        = getTextData(L,"servername");
@@ -872,6 +880,19 @@ int ModApiMainMenu::l_open_dir(lua_State *L)
        return 1;
 }
 
+/******************************************************************************/
+int ModApiMainMenu::l_share_file(lua_State *L)
+{
+#ifdef __ANDROID__
+       std::string path = luaL_checkstring(L, 1);
+       porting::shareFileAndroid(path);
+       lua_pushboolean(L, true);
+#else
+       lua_pushboolean(L, false);
+#endif
+       return 1;
+}
+
 /******************************************************************************/
 int ModApiMainMenu::l_do_async_callback(lua_State *L)
 {
@@ -937,6 +958,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
        API_FCT(get_max_supp_proto);
        API_FCT(open_url);
        API_FCT(open_dir);
+       API_FCT(share_file);
        API_FCT(do_async_callback);
 }