diff --git a/addons/cclua/cocos2d/library/ccui/WebView.lua b/addons/cclua/cocos2d/library/ccui/WebView.lua index 5ca10872..0653168e 100644 --- a/addons/cclua/cocos2d/library/ccui/WebView.lua +++ b/addons/cclua/cocos2d/library/ccui/WebView.lua @@ -10,6 +10,7 @@ ---@field onDidFailLoading ccui.WebView.ccWebViewCallback Get the callback when WebView has failed loading. ---@field onDidFinishLoading ccui.WebView.ccWebViewCallback Get the callback when WebView has finished loading. ---@field onJSCallback ccui.WebView.ccWebViewCallback Get the Javascript callback. +---@field onShouldStartLoading fun(arg1: ccui.WebView, arg2: string): boolean Get the callback when WebView is about to start. ---@field opacityWebView number getOpacity of webview. local WebView = {} @@ -46,10 +47,8 @@ function WebView:getOnDidFinishLoading() end function WebView:getOnJSCallback() end ---Get the callback when WebView is about to start. ----@param sender ccui.WebView ----@param url string ---@return fun(arg1: ccui.WebView, arg2: string): boolean -function WebView:getOnShouldStartLoading(sender, url) end +function WebView:getOnShouldStartLoading() end ---getOpacity of webview. ---@return number diff --git a/frameworks/cclua/src/lua-bindings/lua_cocos2d_ui.cpp b/frameworks/cclua/src/lua-bindings/lua_cocos2d_ui.cpp index 65bec962..22e07c5d 100644 --- a/frameworks/cclua/src/lua-bindings/lua_cocos2d_ui.cpp +++ b/frameworks/cclua/src/lua-bindings/lua_cocos2d_ui.cpp @@ -6785,19 +6785,15 @@ static int _cocos2d_ui_WebView_getOnShouldStartLoading(lua_State *L) olua_startinvoke(L); cocos2d::ui::WebView *self = nullptr; - cocos2d::ui::WebView *arg1 = nullptr; /** sender */ - std::string arg2; /** url */ olua_to_object(L, 1, &self, "ccui.WebView"); - olua_check_object(L, 2, &arg1, "ccui.WebView"); - olua_check_string(L, 3, &arg2); void *cb_store = (void *)self; std::string cb_tag = "OnShouldStartLoading"; olua_getcallback(L, cb_store, cb_tag.c_str(), OLUA_TAG_EQUAL); - // std::function getOnShouldStartLoading(cocos2d::ui::WebView *sender, const std::string &url) - std::function ret = self->getOnShouldStartLoading(arg1, arg2); + // std::function getOnShouldStartLoading() + std::function ret = self->getOnShouldStartLoading(); int num_ret = olua_push_callback(L, &ret, "std.function"); olua_endinvoke(L); @@ -7370,6 +7366,7 @@ static int _ccui_WebView(lua_State *L) oluacls_prop(L, "onDidFailLoading", _cocos2d_ui_WebView_getOnDidFailLoading, _cocos2d_ui_WebView_setOnDidFailLoading); oluacls_prop(L, "onDidFinishLoading", _cocos2d_ui_WebView_getOnDidFinishLoading, _cocos2d_ui_WebView_setOnDidFinishLoading); oluacls_prop(L, "onJSCallback", _cocos2d_ui_WebView_getOnJSCallback, _cocos2d_ui_WebView_setOnJSCallback); + oluacls_prop(L, "onShouldStartLoading", _cocos2d_ui_WebView_getOnShouldStartLoading, _cocos2d_ui_WebView_setOnShouldStartLoading); oluacls_prop(L, "opacityWebView", _cocos2d_ui_WebView_getOpacityWebView, _cocos2d_ui_WebView_setOpacityWebView); return 1; diff --git a/tools/lua-bindings/olua b/tools/lua-bindings/olua index 35559dda..e109c88c 160000 --- a/tools/lua-bindings/olua +++ b/tools/lua-bindings/olua @@ -1 +1 @@ -Subproject commit 35559dda3478fe796b40f9ab486031ab46c031ab +Subproject commit e109c88cc4ec4f9fcbb1f1e6bfe401d910807228