Skip to content

Commit 494ec78

Browse files
committed
Added isURL parameter to requestBrowserDomains/Browser.requestDomains (Addendum to previous commit)
1 parent 7d243c9 commit 494ec78

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Browser.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,24 @@ int CLuaFunctionDefs::CreateBrowser ( lua_State* luaVM )
5555

5656
int CLuaFunctionDefs::RequestBrowserDomains ( lua_State* luaVM )
5757
{
58-
// bool requestBrowserDomains ( table domains )
59-
std::vector<SString> pages;
58+
// bool requestBrowserDomains ( table domains, bool isURL )
59+
std::vector<SString> pages; bool bIsURL;
6060

6161
CScriptArgReader argStream ( luaVM );
6262
argStream.ReadStringTable ( pages );
63+
argStream.ReadBool ( bIsURL, false );
6364

6465
if ( !argStream.HasErrors () )
6566
{
67+
// Convert to domains if we got a list of URLs
68+
if ( bIsURL )
69+
{
70+
for ( auto& strURL : pages )
71+
{
72+
strURL = g_pCore->GetWebCore ()->GetDomainFromURL ( strURL );
73+
}
74+
}
75+
6676
g_pCore->GetWebCore ()->RequestPages ( pages );
6777
// Todo: Add a callback or event to check if the pagerequest dialog was successfully done
6878
lua_pushboolean ( luaVM, true );

0 commit comments

Comments
 (0)