In lua 5.0.2 onwards, lua_strlen() is now lua_rawlen().  Support both of these
by checking the version of lua.
---
 src/scripting/lua/hooks.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c
index b94745a..bffb09d 100644
--- a/src/scripting/lua/hooks.c
+++ b/src/scripting/lua/hooks.c
@@ -144,7 +144,12 @@ script_hook_pre_format_html(va_list ap, void *data)
        if (err) return EVENT_HOOK_STATUS_NEXT;
 
        if (lua_isstring(L, -1)) {
-               int len = lua_strlen(L, -1);
+               int len;
+#if LUA_VERSION_NUM < 501
+               len = lua_strlen(L, -1);
+#else
+               len = lua_rawlen(L, -1);
+#endif
 
                add_fragment(cached, 0, (unsigned char *) lua_tostring(L, -1), 
len);
                normalize_cache_entry(cached, len);
-- 
2.9.0

-- 
http://lists.linuxfromscratch.org/listinfo/elinks-dev
Unsubscribe: See the above information page

Reply via email to