Index: general/genlib/brotli.xml
===================================================================
--- general/genlib/brotli.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ general/genlib/brotli.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -96,7 +96,8 @@
     </para>
 
+    <!-- Brotli doesn't have any lua bindings, at least not with 1.0.7. -->
     <bridgehead renderas="sect4">Optional</bridgehead>
     <para role="optional">
-      <xref linkend="lua"/> (to create Lua bindings) and
+  <!--<xref linkend="lua"/> (to create Lua bindings) and -->
       <xref linkend="python2"/> (to create python2 bindings)
     </para>
Index: general/graphlib/potrace.xml
===================================================================
--- general/graphlib/potrace.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ general/graphlib/potrace.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -33,5 +33,5 @@
       <!-- summarized from the home page, where Potrace(TM) is used -->
       <application>Potrace&#8482;</application> is a tool for transforming a bitmap
-       (PBM, PGM, PPM, or BMP format) into one of several vector file formats.
+      (PBM, PGM, PPM, or BMP format) into one of several vector file formats.
     </para>
 
@@ -76,5 +76,5 @@
     <bridgehead renderas="sect4">Recommended</bridgehead>
     <para role="recommended">
-      <xref linkend="llvm"/> (including <command>clang</command>).
+      <xref linkend="llvm"/> (including <command>clang</command>)
     </para>
 
Index: general/prog/lua.xml
===================================================================
--- general/prog/lua.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ general/prog/lua.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -7,15 +7,13 @@
   <!ENTITY lua-download-http "http://www.lua.org/ftp/lua-&lua-version;.tar.gz">
   <!ENTITY lua-download-ftp  " ">
-  <!ENTITY lua-md5sum        "4f4b4f323fd3514a68e0ab3da8ce3455">
-  <!ENTITY lua-size          "300 KB">
-  <!ENTITY lua-buildsize     "4.5 MB (with Basic tests)">
+  <!ENTITY lua-md5sum        "dbf155764e5d433fc55ae80ea7060b60">
+  <!ENTITY lua-size          "344 KB">
+  <!ENTITY lua-buildsize     "5.5 MB (with Basic tests)">
   <!ENTITY lua-time          "less than 0.1 SBU (with Basic tests)">
 
-<!-- Note for editors - the soname and test suite versions did not change, so I
-     Had to hardcode them. -renodr -->
-  <!ENTITY lua-tests-download-http "http://www.lua.org/tests/lua-5.3.4-tests.tar.gz">
+  <!ENTITY lua-tests-download-http "http://www.lua.org/tests/lua-&lua-version;-tests.tar.gz">
   <!ENTITY lua-tests-download-ftp  " ">
-  <!ENTITY lua-tests-md5sum        "b14fe3748c1cb2d74e3acd1943629ba3">
-  <!ENTITY lua-tests-size          "104 KB">
+  <!ENTITY lua-tests-md5sum        "3d7768b090046506afa974a4ac0c5ba2">
+  <!ENTITY lua-tests-size          "124 KB">
 ]>
 
@@ -128,5 +126,5 @@
 
 <screen><userinput>cat &gt; lua.pc &lt;&lt; "EOF"
-<literal>V=5.3
+<literal>V=5.4
 R=&lua-version;
 
@@ -156,11 +154,13 @@
 
 <screen><userinput>patch -Np1 -i ../lua-&lua-version;-shared_library-1.patch &amp;&amp;
-sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h &amp;&amp;
-
-make MYCFLAGS="-DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" linux</userinput></screen>
+make linux</userinput></screen>
+<!-- make MYCFLAGS="-DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" linux
+     The MYCFLAGS="" part was brought into the patch since optimization had to
+     be turned off.
+     The LUA_ROOT change also has been merged into the patch.-->
 
     <para>
       To test the results, issue: <command>make test</command>.
-      <quote>This will run the interpreter and print its version.</quote>.
+      <quote>This will run the interpreter and print its version</quote>.
       More comprehensive tests can be performed if you downloaded the "Test
       suite" tarball. Those tests need to be executed after the package is
@@ -175,7 +175,6 @@
      INSTALL_DATA="cp -d"            \
      INSTALL_MAN=/usr/share/man/man1 \
-     TO_LIB="liblua.so liblua.so.5.3 liblua.so.5.3.4" \
+     TO_LIB="liblua.so liblua.so.5.4 liblua.so.&lua-version;" \
      install &amp;&amp;
-<!-- As stated above, we have to hardcode 5.3.4. -->
 
 mkdir -pv                      /usr/share/doc/lua-&lua-version; &amp;&amp;
@@ -187,5 +186,5 @@
       Here we describe only the "Basic tests". Untar the tarball and
       change to the
-      <filename class="directory">lua-5.3.4-tests</filename> directory,
+      <filename class="directory">lua-&lua-version;-tests</filename> directory,
       then issue
       <command>lua -e "_U=true" all.lua</command>. If the tests finish without
@@ -193,6 +192,9 @@
     </para>
 
-  </sect2>
-
+    <!-- The optimization problem fixed in the patch was identified by running
+         the test suite, and ultimately culminated in a SIGBUS error. -->
+  </sect2>
+
+  <!-- Brought into the patch, unneeded
   <sect2 role="commands">
     <title>Command Explanations</title>
@@ -210,4 +212,5 @@
 
   </sect2>
+  -->
 
   <sect2 role="content">
Index: general/prog/lua52.xml
===================================================================
--- general/prog/lua52.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ general/prog/lua52.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -172,6 +172,6 @@
 ln -s liblua5.2.so install/usr/lib/liblua.so.&lua52-version; &amp;&amp;
 
-mv install/usr/share/man/man1/{lua.1,lua52.1} &amp;&amp;
-mv install/usr/share/man/man1/{luac.1,luac52.1}</userinput></screen>
+mv install/usr/share/man/man1/{lua.1,lua5.2.1} &amp;&amp;
+mv install/usr/share/man/man1/{luac.1,luac5.2.1}</userinput></screen>
 
     <para>
@@ -209,5 +209,5 @@
       <seglistitem>
         <seg>
-          lua52 and luac52
+          lua5.2 and luac5.2
         </seg>
         <seg>
@@ -235,5 +235,5 @@
           </para>
           <indexterm zone="lua52 lua-prog">
-            <primary sortas="b-lua52">lua52</primary>
+            <primary sortas="b-lua52">lua5.2</primary>
           </indexterm>
         </listitem>
@@ -247,5 +247,5 @@
           </para>
           <indexterm zone="lua52 luac52">
-            <primary sortas="b-luac52">luac52</primary>
+            <primary sortas="b-luac52">luac5.2</primary>
           </indexterm>
         </listitem>
Index: introduction/welcome/changelog.xml
===================================================================
--- introduction/welcome/changelog.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ introduction/welcome/changelog.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -46,4 +46,14 @@
       <itemizedlist>
         <listitem>
+          <para>[renodr] - Update to lua-5.4.0. Fixes
+          <ulink url="&blfs-ticket-root;13742">#13742</ulink>.</para> 
+        </listitem>
+        <listitem>
+          <para>[renodr] - Adapt httpd to lua-5.4 API changes.</para>
+        </listitem>
+        <listitem>
+          <para>[renodr] - Adapt gvim to lua-5.4 API changes.</para>
+        </listitem>
+        <listitem>
           <para>[ken] - note that building rustc can now mostly be restricted to
           a specified number of processors by adding a --jobs switch to each x.py
Index: packages.ent
===================================================================
--- packages.ent	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ packages.ent	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -338,5 +338,5 @@
 <!ENTITY llvm-point-version           "0">
 <!ENTITY llvm-version                 "&llvm-majmin-version;.&llvm-point-version;">
-<!ENTITY lua-version                  "5.3.5">
+<!ENTITY lua-version                  "5.4.0">
 <!ENTITY lua52-version                "5.2.4">
 <!ENTITY mercurial-version            "5.4.1">
Index: postlfs/editors/vim.xml
===================================================================
--- postlfs/editors/vim.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ postlfs/editors/vim.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -132,4 +132,11 @@
 
     <para>
+      First, if you are building the Lua interpreter for VIM, adapt it to an
+      API change in lua-5.4.0:
+    </para>
+
+<screen><userinput remap="pre">sed -i '440 s/static int/int/' src/if_lua.c</userinput></screen>
+
+    <para>
       Install <application>Vim</application> by running the following
       commands:
@@ -239,9 +246,10 @@
 
     <para>
+      <option>--enable-luainterp</option>,
       <option>--enable-perlinterp</option>,
       <option>--enable-pythoninterp</option>,
       <option>--enable-tclinterp</option>,
       <option>--enable-rubyinterp</option>:
-      These options include the Perl, Python, Tcl, or Ruby interpreters that
+      These options include the Lua, Perl, Python, Tcl, or Ruby interpreters that
       allow using other application code in <application>vim</application>
       scripts.
Index: server/mail/dovecot.xml
===================================================================
--- server/mail/dovecot.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ server/mail/dovecot.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -211,4 +211,11 @@
       <application>CLucene</application> full text search support.
     </para>
+   
+    <para>
+      <option>--with-lua</option>: This switch enables
+      <application>Lua</application> plugin support. This includes
+      a mail and push notification plugin.
+    </para>
+
 <!--
     <para>
Index: server/major/apache.xml
===================================================================
--- server/major/apache.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ server/major/apache.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -130,4 +130,10 @@
 useradd -c "Apache Server" -d /srv/www -g apache \
         -s /bin/false -u 25 apache</userinput></screen>
+
+    <para>
+      Adapt the Lua module to API changes in Lua-5.4:
+    </para>
+
+<screen><userinput remap="pre">sed -i 's/lua_resume(a, NULL, b)/lua_resume(a, NULL, b, NULL)/' modules/lua/mod_lua.h</userinput></screen>
 
     <para>
Index: xsoft/other/hexchat.xml
===================================================================
--- xsoft/other/hexchat.xml	(revision 5ce1bdb06cf07da977915716edca8b291d39d6d9)
+++ xsoft/other/hexchat.xml	(revision eb7de89317761cdc3a46082f1bd1869bd86a1a78)
@@ -83,5 +83,6 @@
     <bridgehead renderas="sect4">Recommended</bridgehead>
     <para role="recommended">
-      <xref linkend="gtk2"/> and
+      <xref linkend="gtk2"/>,
+      <xref linkend="libcanberra"/>, and
       <xref linkend="lua"/>
     </para>
@@ -91,5 +92,5 @@
       <xref linkend="dbus-glib"/>,
       <xref linkend="iso-codes"/>,
-      <xref linkend="libcanberra"/>,
+ <!-- <xref linkend="libcanberra"/>, -->
       <xref linkend="libnotify"/>,
       <xref linkend="pciutils"/>, 
