lua-2.1.0: Lua, an embeddable scripting language
Copyright© 2007–2012 Gracjan Polak;
© 2012–2016 Ömer Sinan Ağacan;
© 2017-2022 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+hslua@zeitkraut.de>
Stabilitybeta
Portabilitynon-portable (depends on GHC)
Safe HaskellNone
LanguageHaskell2010

Lua.Types

Description

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

Synopsis

Documentation

newtype 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

State (Ptr ()) 

Instances

Instances details
Eq State # 
Instance details

Defined in Lua.Types

Methods

(==) :: State -> State -> Bool #

(/=) :: State -> State -> Bool #

Generic State # 
Instance details

Defined in Lua.Types

Associated Types

type Rep State :: Type -> Type #

Methods

from :: State -> Rep State x #

to :: Rep State x -> State #

type Rep State # 
Instance details

Defined in Lua.Types

type Rep State = D1 ('MetaData "State" "Lua.Types" "lua-2.1.0-KFi2qUEupCPKdlnmEYIKQz" 'True) (C1 ('MetaCons "State" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Ptr ()))))

type Reader = FunPtr (State -> Ptr () -> Ptr CSize -> IO (Ptr CChar)) #

The reader function used by 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.

newtype TypeCode #

Integer code used to encode the type of a Lua value.

Constructors

TypeCode 

Fields

Instances

Instances details
Eq TypeCode # 
Instance details

Defined in Lua.Types

Ord TypeCode # 
Instance details

Defined in Lua.Types

Show TypeCode # 
Instance details

Defined in Lua.Types

type CFunction = FunPtr PreCFunction #

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_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_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.

type PreCFunction = State -> IO NumResults #

Type of Haskell functions that can be turned into C functions.

This is the same as a dereferenced CFunction.

newtype 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

LuaBool CInt 

Instances

Instances details
Eq LuaBool # 
Instance details

Defined in Lua.Types

Methods

(==) :: LuaBool -> LuaBool -> Bool #

(/=) :: LuaBool -> LuaBool -> Bool #

Show LuaBool # 
Instance details

Defined in Lua.Types

Storable LuaBool # 
Instance details

Defined in Lua.Types

newtype 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

Integer Int64 

Instances

Instances details
Bounded Integer # 
Instance details

Defined in Lua.Types

Enum Integer # 
Instance details

Defined in Lua.Types

Eq Integer # 
Instance details

Defined in Lua.Types

Methods

(==) :: Integer -> Integer -> Bool #

(/=) :: Integer -> Integer -> Bool #

Integral Integer # 
Instance details

Defined in Lua.Types

Num Integer # 
Instance details

Defined in Lua.Types

Ord Integer # 
Instance details

Defined in Lua.Types

Read Integer # 
Instance details

Defined in Lua.Types

Real Integer # 
Instance details

Defined in Lua.Types

Show Integer # 
Instance details

Defined in Lua.Types

newtype 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

Number Double 

Instances

Instances details
Eq Number # 
Instance details

Defined in Lua.Types

Methods

(==) :: Number -> Number -> Bool #

(/=) :: Number -> Number -> Bool #

Floating Number # 
Instance details

Defined in Lua.Types

Fractional Number # 
Instance details

Defined in Lua.Types

Num Number # 
Instance details

Defined in Lua.Types

Ord Number # 
Instance details

Defined in Lua.Types

Read Number # 
Instance details

Defined in Lua.Types

Real Number # 
Instance details

Defined in Lua.Types

RealFloat Number # 
Instance details

Defined in Lua.Types

RealFrac Number # 
Instance details

Defined in Lua.Types

Methods

properFraction :: Integral b => Number -> (b, Number) #

truncate :: Integral b => Number -> b #

round :: Integral b => Number -> b #

ceiling :: Integral b => Number -> b #

floor :: Integral b => Number -> b #

Show Number # 
Instance details

Defined in Lua.Types

newtype StackIndex #

A stack index

Constructors

StackIndex 

Fields

newtype NumArgs #

The number of arguments consumed curing a function call.

Constructors

NumArgs 

Fields

Instances

Instances details
Eq NumArgs # 
Instance details

Defined in Lua.Types

Methods

(==) :: NumArgs -> NumArgs -> Bool #

(/=) :: NumArgs -> NumArgs -> Bool #

Num NumArgs # 
Instance details

Defined in Lua.Types

Ord NumArgs # 
Instance details

Defined in Lua.Types

Show NumArgs # 
Instance details

Defined in Lua.Types

newtype NumResults #

The number of results returned by a function call.

Constructors

NumResults 

Fields

newtype OPCode #

Relational operator code.

Constructors

OPCode CInt 

Instances

Instances details
Eq OPCode # 
Instance details

Defined in Lua.Types

Methods

(==) :: OPCode -> OPCode -> Bool #

(/=) :: OPCode -> OPCode -> Bool #

Show OPCode # 
Instance details

Defined in Lua.Types

Storable OPCode # 
Instance details

Defined in Lua.Types

newtype ArithOPCode #

Arithmetic operator code.

Constructors

ArithOPCode CInt 

Instances

Instances details
Eq ArithOPCode # 
Instance details

Defined in Lua.Types

Show ArithOPCode # 
Instance details

Defined in Lua.Types

Storable ArithOPCode # 
Instance details

Defined in Lua.Types

newtype StatusCode #

Integer code used to signal the status of a thread or computation.

Constructors

StatusCode CInt 

Instances

Instances details
Eq StatusCode # 
Instance details

Defined in Lua.Types

Show StatusCode # 
Instance details

Defined in Lua.Types

Storable StatusCode # 
Instance details

Defined in Lua.Types

Garbage-Collection

newtype GCCode #

Garbage-collection options.

Constructors

GCCode CInt 

Instances

Instances details
Eq GCCode # 
Instance details

Defined in Lua.Types

Methods

(==) :: GCCode -> GCCode -> Bool #

(/=) :: GCCode -> GCCode -> Bool #

Show GCCode # 
Instance details

Defined in Lua.Types

Storable GCCode # 
Instance details

Defined in Lua.Types