|
14 | 14 | void CLuaBrowserDefs::LoadFunctions ( void )
|
15 | 15 | {
|
16 | 16 | // Define browser functions
|
| 17 | + CLuaCFunctions::AddFunction( "isBrowserSupported", IsBrowserSupported ); |
| 18 | + |
17 | 19 | std::map<const char*, lua_CFunction> functions
|
18 | 20 | {
|
19 | 21 | { "createBrowser", CreateBrowser },
|
@@ -49,7 +51,7 @@ void CLuaBrowserDefs::LoadFunctions ( void )
|
49 | 51 | };
|
50 | 52 |
|
51 | 53 | // Add browser functions
|
52 |
| - if ( IsBrowserSupported () ) |
| 54 | + if ( g_pCore->GetWebCore () ) |
53 | 55 | {
|
54 | 56 | for ( const auto& pair : functions )
|
55 | 57 | {
|
@@ -87,6 +89,7 @@ void CLuaBrowserDefs::AddClass ( lua_State* luaVM )
|
87 | 89 | lua_newclass ( luaVM );
|
88 | 90 |
|
89 | 91 | lua_classfunction ( luaVM, "create", "createBrowser" );
|
| 92 | + lua_classfunction ( luaVM, "isSupported", "isBrowserSupported" ); |
90 | 93 | lua_classfunction ( luaVM, "loadURL", "loadBrowserURL" );
|
91 | 94 | lua_classfunction ( luaVM, "isLoading", "isBrowserLoading" );
|
92 | 95 | lua_classfunction ( luaVM, "injectMouseMove", "injectBrowserMouseMove" );
|
@@ -133,12 +136,6 @@ void CLuaBrowserDefs::AddClass ( lua_State* luaVM )
|
133 | 136 | }
|
134 | 137 |
|
135 | 138 |
|
136 |
| -bool CLuaBrowserDefs::IsBrowserSupported () |
137 |
| -{ |
138 |
| - return g_pCore->GetWebCore() != nullptr; |
139 |
| -} |
140 |
| - |
141 |
| - |
142 | 139 | int CLuaBrowserDefs::CreateBrowser ( lua_State* luaVM )
|
143 | 140 | {
|
144 | 141 | // texture createBrowser ( int width, int height, bool isLocal [, bool transparent = false] )
|
@@ -182,6 +179,12 @@ int CLuaBrowserDefs::CreateBrowser ( lua_State* luaVM )
|
182 | 179 | return 1;
|
183 | 180 | }
|
184 | 181 |
|
| 182 | +int CLuaBrowserDefs::IsBrowserSupported ( lua_State* luaVM ) |
| 183 | +{ |
| 184 | + lua_pushboolean ( luaVM, g_pCore->GetWebCore() != nullptr ); |
| 185 | + return 1; |
| 186 | +} |
| 187 | + |
185 | 188 | int CLuaBrowserDefs::RequestBrowserDomains ( lua_State* luaVM )
|
186 | 189 | {
|
187 | 190 | // bool requestBrowserDomains ( table domains, bool isURL [, function callback ] )
|
|
0 commit comments