diff --git a/NEWS b/NEWS index 1cecee85..3f46ab68 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ Miscellaneous: * enhancement: Add ``Search contents'' button to the cache manager with which one can search through the cache items' data rather than their metadata. +* link against lua51 not lua50 ////////////////////////////////////////////////////////////////////// The following changes should be removed from NEWS before ELinks 0.13.0 diff --git a/configure.in b/configure.in index f01aaec6..cf99d471 100644 --- a/configure.in +++ b/configure.in @@ -900,10 +900,10 @@ if test -z "$disable_lua"; then withval=""; fi for luadir in "$withval" "" /usr /usr/local; do - for suffix in "" 50; do + for suffix in "" 51; do if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \ test -f "$luadir/include/lua$suffix/lua.h" ) ; then - LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm" + LUA_LIBS="-L$luadir/lib -llua$suffix -lm" LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix" LIBS="$LUA_LIBS $LIBS_X" @@ -911,13 +911,11 @@ if test -z "$disable_lua"; then CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" # Check that it is a compatible Lua version - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include - #include ]], [[ lua_State *L = lua_open(); - luaopen_base(L); - luaopen_table(L); - luaopen_io(L); - luaopen_string(L); - luaopen_math(L); + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ] + #include + #include + ], [[ lua_State *L = luaL_newstate(); + luaL_openlibs(L); lua_pushboolean(L, 1); lua_close(L);]])],[cf_result=yes],[cf_result=no]) fi diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 0700cc98..5c19056c 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -12,6 +12,7 @@ #include #endif +#include #include #include @@ -659,7 +660,7 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename) if (file_can_read(file)) { int oldtop = lua_gettop(S); - if (lua_dofile(S, file) != 0) + if (luaL_dofile(S, file) != 0) sleep(3); /* Let some time to see error messages. */ lua_settop(S, oldtop); } @@ -670,13 +671,9 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename) void init_lua(struct module *module) { - L = lua_open(); + L = luaL_newstate(); - luaopen_base(L); - luaopen_table(L); - luaopen_io(L); - luaopen_string(L); - luaopen_math(L); + luaL_openlibs(L); lua_register(L, LUA_ALERT, l_alert); lua_register(L, "current_url", l_current_url); @@ -781,7 +778,7 @@ handle_ret_eval(struct session *ses) int oldtop = lua_gettop(L); if (prepare_lua(ses) == 0) { - lua_dostring(L, expr); + luaL_dostring(L, expr); lua_settop(L, oldtop); finish_lua(); } diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c index d79ad80e..49b64141 100644 --- a/src/scripting/lua/hooks.c +++ b/src/scripting/lua/hooks.c @@ -4,6 +4,10 @@ #include "config.h" #endif +#include +#include +#include + #include "elinks.h" #include "cache/cache.h" @@ -200,7 +204,7 @@ static enum evhook_status script_hook_quit(va_list ap, void *data) { if (!prepare_lua(NULL)) { - lua_dostring(lua_state, "if quit_hook then quit_hook() end"); + luaL_dostring(lua_state, "if quit_hook then quit_hook() end"); finish_lua(); }