diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-26 00:39:23 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-26 00:39:23 +0530 |
| commit | 3f56d76a2b0d528c05ab8d0a38059ca82ba90952 (patch) | |
| tree | daae7849815c122803f8ddd08cbfcb87552eab8a /src/LuaRuntimeApi.hpp | |
| parent | 031b22e0bb0f1d132731aea3776917731a8ab4ce (diff) | |
| download | null-browser-3f56d76a2b0d528c05ab8d0a38059ca82ba90952.tar.gz null-browser-3f56d76a2b0d528c05ab8d0a38059ca82ba90952.zip | |
Add set_html for views + example use with decorations
Diffstat (limited to 'src/LuaRuntimeApi.hpp')
| -rw-r--r-- | src/LuaRuntimeApi.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/LuaRuntimeApi.hpp b/src/LuaRuntimeApi.hpp index 9f6c631..17e0fe9 100644 --- a/src/LuaRuntimeApi.hpp +++ b/src/LuaRuntimeApi.hpp @@ -18,6 +18,14 @@ int lua_api_view_set_url(lua_State *state) { return 1; } +int lua_api_view_set_html(lua_State *state) { + const char *html = lua_tostring(state, 1); + WebViewId view_id = lua_isnoneornil(state, 2) ? 0 : lua_tointeger(state, 2); + auto &runtime = LuaRuntime::instance(); + emit runtime.set_view_html(html, view_id); + return 1; +} + int lua_api_view_create(lua_State *state) { const char *url = luaL_optstring(state, 1, ""); auto &runtime = LuaRuntime::instance(); @@ -315,6 +323,7 @@ static luaL_Reg internals_api[] = { luaL_Reg{"view_list", &lua_view_list}, luaL_Reg{"view_select", &lua_view_select}, luaL_Reg{"view_set_url", &lua_api_view_set_url}, + luaL_Reg{"view_set_html", &lua_api_view_set_html}, luaL_Reg{"view_open_devtools", &lua_api_view_open_devtools}, luaL_Reg{"view_scroll", &lua_api_view_scroll}, luaL_Reg{"view_scroll_to_top", &lua_api_view_scroll_top}, |
