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