diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,7 @@
+pandoc (1.14.0.2)
+
+  * Allow building with hslua 0.4.
+
 pandoc (1.14.0.1)
 
   * Fixed problem with building of `reference.docx` and `reference.odt`
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
 Name:            pandoc
-Version:         1.14.0.1
+Version:         1.14.0.2
 Cabal-Version:   >= 1.10
 Build-Type:      Custom
 License:         GPL
@@ -265,7 +265,7 @@
                  yaml >= 0.8.8.2 && < 0.9,
                  scientific >= 0.2 && < 0.4,
                  vector >= 0.10 && < 0.11,
-                 hslua >= 0.3 && < 0.4,
+                 hslua >= 0.3 && < 0.5,
                  binary >= 0.5 && < 0.8,
                  SHA >= 1.6 && < 1.7,
                  haddock-library >= 1.1 && < 1.3,
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -69,6 +69,13 @@
        return (x : rest)
      else return []
 
+#if MIN_VERSION_hslua(0,4,0)
+instance {-# OVERLAPS #-} StackValue [Char] where
+  push lua cs = Lua.push lua (UTF8.fromString cs)
+  peek lua i = do
+                 res <- Lua.peek lua i
+                 return $ UTF8.toString `fmap` res
+#else
 #if MIN_VERSION_base(4,8,0)
 instance {-# OVERLAPS #-} StackValue a => StackValue [a] where
 #else
@@ -86,6 +93,7 @@
     Lua.pop lua 1
     return (Just lst)
   valuetype _ = Lua.TTABLE
+#endif
 
 instance StackValue Format where
   push lua (Format f) = Lua.push lua (map toLower f)
@@ -111,12 +119,20 @@
   peek _ _ = undefined -- not needed for our purposes
   valuetype _ = Lua.TTABLE
 
+#if MIN_VERSION_base(4,8,0)
+instance {-# OVERLAPS #-} StackValue [Inline] where
+#else
 instance StackValue [Inline] where
+#endif
   push l ils = Lua.push l =<< inlineListToCustom l ils
   peek _ _ = undefined
   valuetype _ = Lua.TSTRING
 
+#if MIN_VERSION_base(4,8,0)
+instance {-# OVERLAPS #-} StackValue [Block] where
+#else
 instance StackValue [Block] where
+#endif
   push l ils = Lua.push l =<< blockListToCustom l ils
   peek _ _ = undefined
   valuetype _ = Lua.TSTRING
@@ -167,7 +183,11 @@
   -- check for error in lua script (later we'll change the return type
   -- to handle this more gracefully):
   when (status /= 0) $
+#if MIN_VERSION_hslua(0,4,0)
+    Lua.tostring lua 1 >>= throw . PandocLuaException . UTF8.toString
+#else
     Lua.tostring lua 1 >>= throw . PandocLuaException
+#endif
   Lua.call lua 0 0
   -- TODO - call hierarchicalize, so we have that info
   rendered <- docToCustom lua opts doc
