HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulehslua-core-2.3.2.1Haskell2010

HsLua.Core.Userdata

Convenience functions to convert Haskell values into Lua userdata.

Synopsis
valuenewhsuserdatauv
  1. :: a

    Haskell object

  2. -> Int

    number of extra userdata values

  3. -> LuaE e ()

Creates a new userdata wrapping the given Haskell object. The userdata is pushed to the top of the stack.

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 garbage collected in Lua.

The name may not contain a nul character.

valuefromuserdata
  1. :: StackIndex

    stack index of userdata

  2. -> Name

    expected name of userdata object

  3. -> LuaE e (Maybe a)

Retrieves a Haskell object from userdata at the given index. The userdata must have the given name.