1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-26 01:15:37 +00:00

Merge pull request #131 from oelmekki/lua_api

[lua] expose reload() and goto_url() to lua api
This commit is contained in:
rkd77 2021-11-13 17:02:49 +01:00 committed by GitHub
commit 9f3d9dcef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -651,6 +651,27 @@ lua_error:
/* End of set/get option */
static int
l_reload(LS)
{
reload(lua_ses, CACHE_MODE_INCREMENT);
cls_redraw_all_terminals();
return 1;
}
static int
l_goto_url(LS)
{
if (lua_isstring(S, 1)) {
goto_url(lua_ses, (unsigned char *) lua_tostring(S, 1));
lua_pushnumber(S, 0);
return 1;
}
lua_pushnil(L);
return 1;
}
int
eval_function(LS, int num_args, int num_results)
{
@ -711,6 +732,8 @@ init_lua(struct module *module)
lua_register(L, "xdialog", l_xdialog);
lua_register(L, "set_option", l_set_option);
lua_register(L, "get_option", l_get_option);
lua_register(L, "reload", l_reload);
lua_register(L, "goto_url", l_goto_url);
lua_pushstring(L, elinks_home ? elinks_home
: (char *) CONFDIR);