63 lines
1.5 KiB
Text
63 lines
1.5 KiB
Text
$NetBSD: patch-ac,v 1.2 2006/08/14 22:43:54 thomasklausner Exp $
|
|
|
|
--- lua.c.orig 2003-04-13 20:54:56.000000000 +0000
|
|
+++ lua.c
|
|
@@ -3,6 +3,7 @@
|
|
#ifdef HAVE_LUA
|
|
|
|
#include <setjmp.h>
|
|
+#include <lauxlib.h>
|
|
|
|
lua_State *lua_state;
|
|
|
|
@@ -120,7 +121,7 @@ static int l_pipe_read(LS)
|
|
|
|
static int l_enable_systems_functions(LS)
|
|
{
|
|
- lua_iolibopen(S);
|
|
+ luaopen_io(S);
|
|
lua_register(S, "pipe_read", l_pipe_read);
|
|
return 0;
|
|
}
|
|
@@ -130,17 +131,17 @@ static void do_hooks_file(LS)
|
|
int oldtop = lua_gettop(S);
|
|
unsigned char *file = stracpy(links_home);
|
|
add_to_strn(&file, "hooks.lua");
|
|
- lua_dofile(S, file);
|
|
+ luaL_dofile(S, file);
|
|
mem_free(file);
|
|
lua_settop(S, oldtop);
|
|
}
|
|
|
|
void init_lua()
|
|
{
|
|
- L = lua_open(0);
|
|
- lua_baselibopen(L);
|
|
- lua_strlibopen(L);
|
|
- lua_register(L, LUA_ALERT, l_alert);
|
|
+ L = lua_open();
|
|
+ luaopen_base(L);
|
|
+ luaopen_string(L);
|
|
+ lua_register(L, LUA_TNIL, l_alert);
|
|
lua_register(L, "current_url", l_current_url);
|
|
lua_register(L, "current_link", l_current_link);
|
|
lua_register(L, "current_document", l_current_document);
|
|
@@ -190,7 +191,7 @@ static void lua_console_eval(struct sess
|
|
}
|
|
oldtop = lua_gettop(L);
|
|
if (!prepare_lua(ses)) {
|
|
- lua_dostring(L, expr);
|
|
+ luaL_dostring(L, expr);
|
|
lua_settop(L, oldtop);
|
|
finish_lua();
|
|
}
|
|
@@ -227,9 +228,7 @@ void lua_console(struct session *ses, un
|
|
}
|
|
lua_pushstring(L, expr);
|
|
if (prepare_lua(ses)) return;
|
|
- err = lua_call(L, 1, 2);
|
|
finish_lua();
|
|
- if (err) return;
|
|
|
|
if ((act = lua_tostring(L, -2))) {
|
|
if (!strcmp(act, "eval")) lua_console_eval(ses);
|