HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelua-2.3.2Haskell2010

Lua.Types

The core Lua types, including mappings of Lua types to Haskell.

  • 17 types
  • Packagelua-2.3.2
  • Exports17
  • LanguageHaskell2010
  • LicenceMIT
  • SourceTypes.hsc
newtypenewtype State
#

An opaque structure that points to a thread and indirectly (through the thread) to the whole state of a Lua interpreter. The Lua library is fully reentrant: it has no global variables. All information about a state is accessible through this structure.

Synonym for lua_State *. See lua_State.

Constructors

Instances3Eq, Generic, Rep
typetype Reader = FunPtr (State -> Ptr () -> Ptr CSize -> IO (Ptr CChar))
#

The reader function used by Lua.load. Every time it needs another piece of the chunk, lua_load calls the reader, passing along its data parameter. The reader must return a pointer to a block of memory with a new piece of the chunk and set size to the block size. The block must exist until the reader function is called again. To signal the end of the chunk, the reader must return NULL or set size to zero. The reader function may return pieces of any size greater than zero.

See lua_Reader.

Type for C functions.

In order to communicate properly with Lua, a C function must use the following protocol, which defines the way parameters and results are passed: a C function receives its arguments from Lua in its stack in direct order (the first argument is pushed first). So, when the function starts, Lua.Functions.lua_gettop returns the number of arguments received by the function. The first argument (if any) is at index 1 and its last argument is at index Lua.Functions.lua_gettop. To return values to Lua, a C function just pushes them onto the stack, in direct order (the first result is pushed first), and returns the number of results. Any other value in the stack below the results will be properly discarded by Lua. Like a Lua function, a C function called by Lua can also return many results.

See lua_CFunction.

typetype WarnFunction = FunPtr (Ptr () -> CString -> LuaBool -> IO ())
#

The type of warning functions, called by Lua to emit warnings. The first parameter is an opaque pointer set by lua_setwarnf. The second parameter is the warning message. The third parameter is a boolean that indicates whether the message is to be continued by the message in the next call.

See warn for more details about warnings.

newtypenewtype LuaBool
#

Boolean value returned by a Lua C API function. This is a CInt and should be interpreted as False iff the value is 0, True otherwise.

Constructors

Instances3Eq, Show, Storable
newtypenewtype Integer
#

The type of integers in Lua.

By default this type is Int64, but that can be changed to different values in Lua. (See LUA_INT_TYPE in luaconf.h.)

See lua_Integer.

Constructors

Instances9Bounded, Enum, Eq, Integral, Num, Ord, …
newtypenewtype Number
#

The type of floats in Lua.

By default this type is Double, but that can be changed in Lua to a single float or a long double. (See LUA_FLOAT_TYPE in luaconf.h.)

See lua_Number.

Constructors

Instances10Eq, Floating, Fractional, Num, Ord, Read, …

Garbage-Collection

1 declaration