diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,27 @@
 
 `hslua-core` uses [PVP Versioning][].
 
+## hslua-core-2.3.0
+
+Released 2023-03-13.
+
+-   The functions `loadfile`, `dofile`, and `dofileTrace` now
+    expect the argument to be of type `Maybe FilePath`. The
+    functions load from *stdin* when the argument is `Nothing`.
+
+-   Added `setwarnf'` for simple warning messgae handling: The
+    built-in method of setting a warn function is flexible but not
+    straight-forward to use. The new `setwarnf'` function allows
+    to set a Haskell action as a warning hook: the default warning
+    behavior is kept in place, but, in addition to the default
+    action, the hook is called on the concatenated warning
+    messages. This can be used to plug Lua warnings into an
+    application specific Haskell reporting system.
+
+-   Export `GCManagedState`, `newGCManagedState`,
+    `closeGCManagedState`, and `withGCManagedState` from
+    `HsLua.Core`.
+
 ## hslua-core-2.2.1
 
 Released 2022-06-19.
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,7 @@
 Copyright © 1994-2022 Lua.org, PUC-Rio.
 Copyright © 2007-2012 Gracjan Polak
 Copyright © 2012-2015 Ömer Sinan Ağacan
-Copyright © 2016-2022 Albert Krewinkel
+Copyright © 2016-2023 Albert Krewinkel
 
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the
diff --git a/hslua-core.cabal b/hslua-core.cabal
--- a/hslua-core.cabal
+++ b/hslua-core.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 name:                hslua-core
-version:             2.2.1
+version:             2.3.0
 synopsis:            Bindings to Lua, an embeddable scripting language
 description:         Wrappers and helpers to bridge Haskell and
                      <https://www.lua.org/ Lua>.
@@ -12,23 +12,22 @@
 license:             MIT
 license-file:        LICENSE
 author:              Albert Krewinkel, Gracjan Polak, Ömer Sinan Ağacan
-maintainer:          albert+hslua@zeitkraut.de
+maintainer:          tarleb@hslua.org
 copyright:           © 2007–2012 Gracjan Polak;
                      © 2012–2016 Ömer Sinan Ağacan;
-                     © 2017-2022 Albert Krewinkel
+                     © 2017-2023 Albert Krewinkel
 category:            Foreign
 build-type:          Simple
 extra-source-files:  README.md
                    , CHANGELOG.md
                    , test/lua/*.lua
-tested-with:         GHC == 8.0.2
-                   , GHC == 8.2.2
-                   , GHC == 8.4.4
+tested-with:         GHC == 8.4.4
                    , GHC == 8.6.5
                    , GHC == 8.8.4
                    , GHC == 8.10.7
                    , GHC == 9.0.2
-                   , GHC == 9.2.3
+                   , GHC == 9.2.5
+                   , GHC == 9.4.4
 
 source-repository head
   type:                git
@@ -36,10 +35,10 @@
 
 common common-options
   default-language:    Haskell2010
-  build-depends:       base          >= 4.8    && < 5
+  build-depends:       base          >= 4.11   && < 5
                      , bytestring    >= 0.10.2 && < 0.12
                      , exceptions    >= 0.8    && < 0.11
-                     , lua           >= 2.2.1  && < 2.3
+                     , lua           >= 2.3    && < 2.4
                      , mtl           >= 2.2    && < 2.4
                      , text          >= 1.2    && < 2.1
   ghc-options:         -Wall
@@ -69,6 +68,7 @@
                      , HsLua.Core.Utf8
   other-modules:       HsLua.Core.Auxiliary
                      , HsLua.Core.Primary
+                     , HsLua.Core.Warn
   reexported-modules:  lua:Lua
   hs-source-dirs:      src
   default-extensions:  LambdaCase
@@ -96,6 +96,7 @@
                      , HsLua.Core.TraceTests
                      , HsLua.Core.UnsafeTests
                      , HsLua.Core.UserdataTests
+                     , HsLua.Core.WarnTests
                      , Test.Tasty.HsLua
                      , Test.HsLua.Arbitrary
   build-depends:       hslua-core
diff --git a/src/HsLua/Core.hs b/src/HsLua/Core.hs
--- a/src/HsLua/Core.hs
+++ b/src/HsLua/Core.hs
@@ -2,9 +2,9 @@
 Module      : HsLua.Core
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
@@ -19,6 +19,10 @@
     run
   , runWith
   , runEither
+  , GCManagedState
+  , newGCManagedState
+  , closeGCManagedState
+  , withGCManagedState
   -- * Lua Computations
   , LuaE (..)
   , Lua
@@ -144,6 +148,7 @@
   , concat
   , pushglobaltable
   , register
+  , setwarnf
   -- * loading libraries
   , openbase
   , opendebug
@@ -183,6 +188,8 @@
   , callTrace
   , dofileTrace
   , dostringTrace
+  -- ** Warnings
+  , setwarnf'
   -- * Haskell userdata values
   --
   -- | Push arbitrary Haskell values to the Lua stack.
@@ -221,3 +228,4 @@
 import HsLua.Core.Trace
 import HsLua.Core.Types as Lua
 import HsLua.Core.Userdata
+import HsLua.Core.Warn
diff --git a/src/HsLua/Core/Auxiliary.hs b/src/HsLua/Core/Auxiliary.hs
--- a/src/HsLua/Core/Auxiliary.hs
+++ b/src/HsLua/Core/Auxiliary.hs
@@ -6,9 +6,9 @@
 Module      : HsLua.Core.Auxiliary
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
@@ -87,8 +87,8 @@
 -- | Loads and runs the given file. Note that the filepath is
 -- interpreted by Lua, not Haskell. The resulting chunk is named using
 -- the UTF8 encoded filepath.
-dofile :: FilePath -> LuaE e Status
-dofile fp = loadfile fp >>= \case
+dofile :: Maybe FilePath -> LuaE e Status
+dofile mfp = loadfile mfp >>= \case
   Lua.OK -> Lua.pcall 0 multret Nothing
   err    -> return err
 {-# INLINABLE dofile #-}
@@ -161,8 +161,9 @@
 {-# INLINABLE loadbuffer #-}
 
 -- | Loads a file as a Lua chunk. This function uses @lua_load@ (see
--- @'Lua.load'@) to load the chunk in the file named filename. The first
--- line in the file is ignored if it starts with a @#@.
+-- @'Lua.load'@) to load the chunk in the file named @filename@. If
+-- filename is @Nothing@, then it loads from the standard input. The
+-- first line in the file is ignored if it starts with a @#@.
 --
 -- The string mode works as in function @'Lua.load'@.
 --
@@ -174,15 +175,19 @@
 -- it.
 --
 -- See <https://www.lua.org/manual/5.4/manual.html#luaL_loadfile luaL_loadfile>.
-loadfile :: FilePath -- ^ filename
+loadfile :: Maybe FilePath -- ^ filename
          -> LuaE e Status
-loadfile fp = liftLua $ \l -> do
+loadfile mfp = liftLua $ \l -> do
 #if defined(mingw32_HOST_OS)
   fsEncoding <- GHC.mkTextEncoding "CP0"  -- a.k.a CP_ACP
 #else
   fsEncoding <- GHC.getFileSystemEncoding
 #endif
-  GHC.withCString fsEncoding fp $! fmap Lua.toStatus . luaL_loadfile l
+  case mfp of
+    Just fp ->
+      GHC.withCString fsEncoding fp $! fmap Lua.toStatus . luaL_loadfile l
+    Nothing ->
+      Lua.toStatus <$!> luaL_loadfile l nullPtr
 {-# INLINABLE loadfile #-}
 
 -- | Loads a string as a Lua chunk. This function uses @lua_load@ to
diff --git a/src/HsLua/Core/Closures.hs b/src/HsLua/Core/Closures.hs
--- a/src/HsLua/Core/Closures.hs
+++ b/src/HsLua/Core/Closures.hs
@@ -2,9 +2,9 @@
 Module      : HsLua.Core.Closures
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
diff --git a/src/HsLua/Core/Error.hs b/src/HsLua/Core/Error.hs
--- a/src/HsLua/Core/Error.hs
+++ b/src/HsLua/Core/Error.hs
@@ -8,9 +8,9 @@
 {-# OPTIONS_GHC -Wno-warnings-deprecations #-}
 {-|
 Module      : HsLua.Core.Error
-Copyright   : © 2017-2022 Albert Krewinkel
+Copyright   : © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 
 Lua exceptions and exception handling.
 -}
diff --git a/src/HsLua/Core/Package.hs b/src/HsLua/Core/Package.hs
--- a/src/HsLua/Core/Package.hs
+++ b/src/HsLua/Core/Package.hs
@@ -1,8 +1,8 @@
 {-|
 Module      : HsLua.Core.Package
-Copyright   : © 2019-2022 Albert Krewinkel
+Copyright   : © 2019-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <albert+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : alpha
 Portability : Requires GHC 8 or later.
 
diff --git a/src/HsLua/Core/Primary.hs b/src/HsLua/Core/Primary.hs
--- a/src/HsLua/Core/Primary.hs
+++ b/src/HsLua/Core/Primary.hs
@@ -3,9 +3,9 @@
 Module      : HsLua.Core.Primary
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
@@ -887,6 +887,15 @@
 setiuservalue :: StackIndex {- ^ index -} -> Int {- ^ n -} -> LuaE e Bool
 setiuservalue idx n = liftLua $ \l ->
   fromLuaBool <$!> lua_setiuservalue l idx (fromIntegral n)
+
+-- | Sets the warning function to be used by Lua to emit warnings (see
+-- 'WarnFunction'). The @ud@ parameter sets the value @ud@ passed to the
+-- warning function.
+setwarnf :: WarnFunction -- ^ f
+         -> Ptr ()       -- ^ ud
+         -> LuaE e ()
+setwarnf f ud = liftLua $ \l ->
+  lua_setwarnf l f ud
 
 -- |  Returns the status of this Lua thread.
 --
diff --git a/src/HsLua/Core/Run.hs b/src/HsLua/Core/Run.hs
--- a/src/HsLua/Core/Run.hs
+++ b/src/HsLua/Core/Run.hs
@@ -2,9 +2,9 @@
 Module      : HsLua.Core.Run
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
diff --git a/src/HsLua/Core/Trace.hs b/src/HsLua/Core/Trace.hs
--- a/src/HsLua/Core/Trace.hs
+++ b/src/HsLua/Core/Trace.hs
@@ -1,9 +1,9 @@
 {-# LANGUAGE TypeApplications #-}
 {-|
 Module      : HsLua.Core.Trace
-Copyright   : © 2017-2022 Albert Krewinkel
+Copyright   : © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 
 Helper functions to call Lua functions with tracebacks.
 -}
@@ -44,7 +44,7 @@
 
 -- | Run the given file as a Lua program, while also adding a
 -- traceback to the error message if an error occurs.
-dofileTrace :: FilePath -> LuaE e Status
+dofileTrace :: Maybe FilePath -> LuaE e Status
 dofileTrace fp = loadfile fp >>= \case
   OK -> pcallTrace 0 multret
   s  -> pure s
diff --git a/src/HsLua/Core/Types.hs b/src/HsLua/Core/Types.hs
--- a/src/HsLua/Core/Types.hs
+++ b/src/HsLua/Core/Types.hs
@@ -1,12 +1,11 @@
-{-# LANGUAGE CPP #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-|
 Module      : HsLua.Core.Types
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
@@ -81,9 +80,6 @@
   , toReference
   )
 import qualified HsLua.Core.Utf8 as Utf8
-#if !MIN_VERSION_base(4,12,0)
-import Data.Semigroup (Semigroup)
-#endif
 
 -- | Environment in which Lua computations are evaluated.
 newtype LuaEnvironment = LuaEnvironment
@@ -129,6 +125,9 @@
 {-# INLINABLE runWith #-}
 
 -- | Run the given operation, but crash if any Haskell exceptions occur.
+--
+-- This function is identical to 'runWith'; it exists for backwards
+-- compatibility.
 unsafeRunWith :: State -> LuaE e a -> IO a
 unsafeRunWith = runWith
 
@@ -153,7 +152,7 @@
   | TypeFunction       -- ^ type of functions, either normal or @'CFunction'@
   | TypeUserdata       -- ^ type of full user data
   | TypeThread         -- ^ type of Lua threads
-  deriving (Bounded, Eq, Ord, Show)
+  deriving (Bounded, Eq, Ord, Show, Read)
 
 instance Enum Type where
   fromEnum = fromIntegral . fromTypeCode . fromType
diff --git a/src/HsLua/Core/Unsafe.hs b/src/HsLua/Core/Unsafe.hs
--- a/src/HsLua/Core/Unsafe.hs
+++ b/src/HsLua/Core/Unsafe.hs
@@ -1,9 +1,9 @@
 {-# OPTIONS_GHC -Wno-warnings-deprecations #-}
 {-|
 Module      : HsLua.Core.Unsafe
-Copyright   : © 2019-2022 Albert Krewinkel
+Copyright   : © 2019-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <albert+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 
 Unsafe Lua functions.
 
diff --git a/src/HsLua/Core/Userdata.hs b/src/HsLua/Core/Userdata.hs
--- a/src/HsLua/Core/Userdata.hs
+++ b/src/HsLua/Core/Userdata.hs
@@ -3,9 +3,9 @@
 Module      : HsLua.Core.Userdata
 Copyright   : © 2007–2012 Gracjan Polak;
               © 2012–2016 Ömer Sinan Ağacan;
-              © 2017-2022 Albert Krewinkel
+              © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
@@ -29,7 +29,9 @@
 
 -- | Creates a new userdata wrapping the given Haskell object. The
 -- userdata is pushed to the top of the stack.
-newhsuserdatauv :: forall a e. a -> Int -> LuaE e ()
+newhsuserdatauv :: forall a e. a -- ^ Haskell object
+                -> Int           -- ^ number of extra userdata values
+                -> LuaE e ()
 newhsuserdatauv x nuvalue = liftLua $ \l ->
   hslua_newhsuserdatauv l x (fromIntegral nuvalue)
 {-# INLINABLE newhsuserdatauv #-}
@@ -37,6 +39,8 @@
 -- | Creates and registers a new metatable for a userdata-wrapped
 -- Haskell value; checks whether a metatable of that name has been
 -- registered yet and uses the registered table if possible.
+--
+-- Returns 'True' if a new metatable was created, and 'False' otherwise.
 --
 -- Using a metatable created by this functions ensures that the pointer
 -- to the Haskell value will be freed when the userdata object is
diff --git a/src/HsLua/Core/Utf8.hs b/src/HsLua/Core/Utf8.hs
--- a/src/HsLua/Core/Utf8.hs
+++ b/src/HsLua/Core/Utf8.hs
@@ -1,8 +1,8 @@
 {-|
 Module      : HsLua.Core.Utf8
-Copyright   : © 2018-2022 Albert Krewinkel
+Copyright   : © 2018-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : portable
 
diff --git a/src/HsLua/Core/Warn.hs b/src/HsLua/Core/Warn.hs
new file mode 100644
--- /dev/null
+++ b/src/HsLua/Core/Warn.hs
@@ -0,0 +1,42 @@
+{-|
+Module      : HsLua.Core.Warn
+Copyright   : © 2023 Albert Krewinkel
+License     : MIT
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
+
+Simpler interface to the Lua warnings system.
+
+This module simplifies the process of setting a custom warn function.
+-}
+module HsLua.Core.Warn
+  ( setwarnf'
+  ) where
+
+import Data.ByteString (ByteString)
+import HsLua.Core.Closures (pushHaskellFunction)
+import HsLua.Core.Error (LuaError)
+import HsLua.Core.Primary (tostring)
+import HsLua.Core.Types (LuaE, NumResults (..), liftLua, nthBottom)
+import Lua.Warn (hsluaL_setwarnf)
+
+-- | Sets a warning function. This is a simplified version of
+-- 'lua_setwarnf'. The given function is called with the concatenated
+-- warning components as the single argument.
+--
+-- Control messages are handled internally and are /not/ passed on the
+-- warning hook. As with the default warning function, the control
+-- messages @\@on@ and @\@off@ can switch error reporting to stderr on
+-- and off. The given Haskell function will be called in either case,
+-- even when the error is not written to stderr.
+--
+-- Wraps 'hsluaL_setwarnf'.
+setwarnf' :: LuaError e
+          => (ByteString -> LuaE e ())
+          -> LuaE e ()
+setwarnf' fn = do
+  pushHaskellFunction $ do
+    mbmsg <- tostring (nthBottom 1)
+    case mbmsg of
+      Nothing  -> pure (NumResults 0)  -- couldn't get warning msg; do nothing
+      Just msg -> NumResults 0 <$ fn msg
+  liftLua hsluaL_setwarnf
diff --git a/test/HsLua/Core/ClosuresTests.hs b/test/HsLua/Core/ClosuresTests.hs
--- a/test/HsLua/Core/ClosuresTests.hs
+++ b/test/HsLua/Core/ClosuresTests.hs
@@ -2,10 +2,10 @@
 {-# OPTIONS_GHC -fno-warn-deprecations #-}
 {-|
 Module      :  HsLua.Core.ClosuresTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 Stability   :  stable
 Portability :  portable
 
diff --git a/test/HsLua/Core/PackageTests.hs b/test/HsLua/Core/PackageTests.hs
--- a/test/HsLua/Core/PackageTests.hs
+++ b/test/HsLua/Core/PackageTests.hs
@@ -1,10 +1,10 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-|
 Module      :  HsLua.Core.RunTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 Stability   :  stable
 Portability :  portable
 
diff --git a/test/HsLua/Core/RunTests.hs b/test/HsLua/Core/RunTests.hs
--- a/test/HsLua/Core/RunTests.hs
+++ b/test/HsLua/Core/RunTests.hs
@@ -3,10 +3,10 @@
 {-# OPTIONS_GHC -fno-warn-deprecations #-}
 {-|
 Module      :  HsLua.Core.RunTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 Stability   :  stable
 Portability :  portable
 
diff --git a/test/HsLua/Core/TraceTests.hs b/test/HsLua/Core/TraceTests.hs
--- a/test/HsLua/Core/TraceTests.hs
+++ b/test/HsLua/Core/TraceTests.hs
@@ -1,10 +1,10 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-|
 Module      :  HsLua.Core.TraceTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 Stability   :  stable
 Portability :  portable
 
diff --git a/test/HsLua/Core/UnsafeTests.hs b/test/HsLua/Core/UnsafeTests.hs
--- a/test/HsLua/Core/UnsafeTests.hs
+++ b/test/HsLua/Core/UnsafeTests.hs
@@ -2,9 +2,9 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-|
 Module      : HsLua.Core.UnsafeTests
-Copyright   : © 2021-2022 Albert Krewinkel
+Copyright   : © 2021-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 
 Tests for bindings to unsafe functions.
diff --git a/test/HsLua/Core/UserdataTests.hs b/test/HsLua/Core/UserdataTests.hs
--- a/test/HsLua/Core/UserdataTests.hs
+++ b/test/HsLua/Core/UserdataTests.hs
@@ -1,10 +1,10 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-|
 Module      :  HsLua.Core.UserdataTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 
 Tests that any data type can be pushed to Lua.
 -}
diff --git a/test/HsLua/Core/WarnTests.hs b/test/HsLua/Core/WarnTests.hs
new file mode 100644
--- /dev/null
+++ b/test/HsLua/Core/WarnTests.hs
@@ -0,0 +1,33 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-|
+Module      :  HsLua.Core.WarnTests
+Copyright   :  © 2017-2023 Albert Krewinkel
+License     :  MIT
+
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
+
+Check that setting hook for warning messages works.
+-}
+module HsLua.Core.WarnTests (tests) where
+
+import HsLua.Core
+import Test.Tasty.HsLua ((=:), shouldBeResultOf)
+import Test.Tasty (TestTree, testGroup)
+
+-- | Specifications for Attributes parsing functions.
+tests :: TestTree
+tests = testGroup "Warn"
+  [ "warnings get handled" =:
+    Just "Hi Mom!" `shouldBeResultOf` do
+      openlibs
+      setwarnf' $ \msg -> do
+        pushstring msg
+        setfield registryindex "hslua testing"
+      stat <- dostring "warn('Hi', ' ', 'Mom!')"
+      case stat of
+        OK -> do
+          getfield registryindex "hslua testing"
+          tostring top
+        _  -> do
+          throwErrorAsException
+  ]
diff --git a/test/HsLua/CoreTests.hs b/test/HsLua/CoreTests.hs
--- a/test/HsLua/CoreTests.hs
+++ b/test/HsLua/CoreTests.hs
@@ -3,10 +3,10 @@
 {-# OPTIONS_GHC -fno-warn-deprecations #-}
 {-|
 Module      :  HsLua.CoreTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 Stability   :  stable
 Portability :  portable
 
@@ -41,6 +41,7 @@
 import qualified HsLua.Core.TraceTests
 import qualified HsLua.Core.UnsafeTests
 import qualified HsLua.Core.UserdataTests
+import qualified HsLua.Core.WarnTests
 import qualified Foreign.Marshal as Foreign
 import qualified Foreign.Ptr as Foreign
 import qualified Test.QuickCheck.Monadic as QCMonadic
@@ -345,17 +346,17 @@
 
     , testGroup "loadfile"
       [ "file error should be returned when file does not exist" =:
-        ErrFile `shouldBeResultOf` loadfile "./file-does-not-exist.lua"
+        ErrFile `shouldBeResultOf` loadfile (Just "./file-does-not-exist.lua")
 
       , "loading an invalid file should give a syntax error" =:
-        ErrSyntax `shouldBeResultOf` loadfile "test/lua/syntax-error.lua"
+        ErrSyntax `shouldBeResultOf` loadfile (Just "test/lua/syntax-error.lua")
 
       , "loading a valid program should succeed" =:
-        OK `shouldBeResultOf` loadfile "./test/lua/example.lua"
+        OK `shouldBeResultOf` loadfile (Just "./test/lua/example.lua")
 
       , "example fib program should be loaded correctly" =:
         Just 8 `shouldBeResultOf` do
-          loadfile "./test/lua/example.lua" *> call 0 0
+          loadfile (Just "./test/lua/example.lua") *> call 0 0
           getglobal "fib"
           pushinteger 6
           call 1 1
@@ -364,20 +365,20 @@
 
     , testGroup "dofile"
       [ "file error should be returned when file does not exist" =:
-        ErrFile `shouldBeResultOf` dofile "./file-does-not-exist.lua"
+        ErrFile `shouldBeResultOf` dofile (Just "./file-does-not-exist.lua")
 
       , "loading an invalid file should give a syntax error" =:
-        ErrSyntax `shouldBeResultOf` dofile "test/lua/syntax-error.lua"
+        ErrSyntax `shouldBeResultOf` dofile (Just "test/lua/syntax-error.lua")
 
       , "loading a failing program should give an run error" =:
-        ErrRun `shouldBeResultOf` dofile "test/lua/error.lua"
+        ErrRun `shouldBeResultOf` dofile (Just "test/lua/error.lua")
 
       , "loading a valid program should succeed" =:
-        OK `shouldBeResultOf` dofile "./test/lua/example.lua"
+        OK `shouldBeResultOf` dofile (Just "./test/lua/example.lua")
 
       , "example fib program should be loaded correctly" =:
         Just 21 `shouldBeResultOf` do
-          _ <- dofile "./test/lua/example.lua"
+          _ <- dofile (Just "./test/lua/example.lua")
           getglobal "fib"
           pushinteger 8
           call 1 1
@@ -454,6 +455,7 @@
   , HsLua.Core.TraceTests.tests
   , HsLua.Core.UnsafeTests.tests
   , HsLua.Core.UserdataTests.tests
+  , HsLua.Core.WarnTests.tests
   ]
 
 compareWith :: (Lua.Integer -> Lua.Integer -> Bool)
diff --git a/test/Test/HsLua/Arbitrary.hs b/test/Test/HsLua/Arbitrary.hs
--- a/test/Test/HsLua/Arbitrary.hs
+++ b/test/Test/HsLua/Arbitrary.hs
@@ -2,10 +2,10 @@
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 {-|
 Module      :  HsLua.Core.RunTests
-Copyright   :  © 2017-2022 Albert Krewinkel
+Copyright   :  © 2017-2023 Albert Krewinkel
 License     :  MIT
 
-Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>
 Stability   :  stable
 Portability :  portable
 
diff --git a/test/Test/Tasty/HsLua.hs b/test/Test/Tasty/HsLua.hs
--- a/test/Test/Tasty/HsLua.hs
+++ b/test/Test/Tasty/HsLua.hs
@@ -1,9 +1,9 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-|
 Module      : Test.Tasty.HsLua
-Copyright   : © 2017-2022 Albert Krewinkel
+Copyright   : © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 Stability   : beta
 Portability : non-portable (depends on GHC)
 
diff --git a/test/test-hslua-core.hs b/test/test-hslua-core.hs
--- a/test/test-hslua-core.hs
+++ b/test/test-hslua-core.hs
@@ -1,8 +1,8 @@
 {-|
 Module      : Main
-Copyright   : © 2017-2022 Albert Krewinkel
+Copyright   : © 2017-2023 Albert Krewinkel
 License     : MIT
-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
+Maintainer  : Albert Krewinkel <tarleb@hslua.org>
 
 Tests for HsLua.Core.
 -}
