HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehslua-core-2.3.2Haskell2010

HsLua.Core.Userdata

Convenience functions to convert Haskell values into Lua userdata.

  • 4 values
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.

valuenewudmetatable :: Name -> LuaE e Bool
#

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.

valueputuserdata
  1. :: StackIndex

    index

  2. -> Name

    name

  3. -> a

    new value

  4. -> LuaE e Bool
#

Replaces the Haskell value contained in the userdata value at index. Checks that the userdata is of type name and returns True on success, or False otherwise.