package ocaml-lua

  1. Overview
  2. Docs

The Lua Auxiliary Library (OCaml binding)

Difference with the original Lua Auxiliary Library

Here is a list of functions of which you should read documentation:

Types definitions

type buffer

See luaL_Buffer documentation.

type reg = string * Lua_api_lib.oCamlFunction

See luaL_reg documentation.

Constant values

val refnil : int

Value returned by `luaL_ref` and `luaL_unref`. See luaL_ref and luaL_unref documentation.

val noref : int

Value returned by `luaL_ref` and `luaL_unref`. See luaL_ref and luaL_unref documentation.

The Auxiliary Library functions

val addchar : buffer -> char -> unit

See luaL_addchar documentation.

NOTE: this function is not a binding of the original luaL_addchar, it's rather an OCaml function with the same semantics.

val addlstring : buffer -> string -> unit

See luaL_addlstring documentation.

NOTE: this function is not a binding of the original luaL_addlstring, it's rather an OCaml function with the same semantics.

The function luaL_addsize is not present because the type Lua_aux_lib.buffer and related functions have been reimplemented in OCaml, and luaL_addsize is not needed.

val addstring : buffer -> string -> unit

See luaL_addstring documentation.

NOTE: this function is an alias of Lua_aux_lib.addlstring

val addvalue : buffer -> unit

See luaL_addvalue documentation.

NOTE: this function is not a binding of the original luaL_addvalue, it's rather an OCaml function with the same semantics.

val argcheck : Lua_api_lib.state -> bool -> int -> string -> unit

See luaL_argcheck documentation.

val argerror : Lua_api_lib.state -> int -> string -> 'a

See luaL_argerror documentation.

val buffinit : Lua_api_lib.state -> buffer

See luaL_buffinit documentation.

val callmeta : Lua_api_lib.state -> int -> string -> bool

See luaL_callmeta documentation.

val checkany : Lua_api_lib.state -> int -> unit

See luaL_checkany documentation.

val checkint : Lua_api_lib.state -> int -> int

See luaL_checkint documentation.

val checkinteger : Lua_api_lib.state -> int -> int

See luaL_checkinteger documentation.

NOTE: this function is an alias of Lua_aux_lib.checkint

val checklong : Lua_api_lib.state -> int -> int

See luaL_checklong documentation.

val checklstring : Lua_api_lib.state -> int -> string

See luaL_checklstring documentation.

NOTE:The original len argument is missing because, unlike in C, there is no impedance mismatch between OCaml and Lua strings.

NOTE: this function is not a binding of the original luaL_checklstring, it's rather an OCaml function with the same semantics.

val checkstring : Lua_api_lib.state -> int -> string

See luaL_checkstring documentation.

NOTE: this function is an alias of Lua_aux_lib.checklstring

val checknumber : Lua_api_lib.state -> int -> float

See luaL_checknumber documentation.

NOTE: this function is not a binding of the original luaL_checknumber, it's rather an OCaml function with the same semantics.

val checkoption : Lua_api_lib.state -> int -> string option -> string list -> int

See luaL_checkoption documentation.

NOTE: this function is not a binding of the original luaL_checkoption, it's rather an OCaml function with the same semantics.

val checkstack : Lua_api_lib.state -> int -> string -> unit

See luaL_checkstack documentation.

NOTE: this function is not a binding of the original luaL_checkstack, it's rather an OCaml function with the same semantics.

val checktype : Lua_api_lib.state -> int -> Lua_api_lib.lua_type -> unit

See luaL_checktype documentation.

NOTE: this function is not a binding of the original luaL_checktype, it's rather an OCaml function with the same semantics.

val checkudata : Lua_api_lib.state -> int -> string -> [> `Userdata of 'a | `Light_userdata of 'a ] option

See luaL_checkudata documentation.

NOTE: this function is not a binding of the original luaL_checkudata, it's rather an OCaml function with the same semantics.

val dofile : Lua_api_lib.state -> string -> bool

See luaL_dofile documentation.

NOTE: this function is not a binding of the original luaL_dofile, it's rather an OCaml function with the same semantics.

val dostring : Lua_api_lib.state -> string -> bool

See luaL_dostring documentation.

NOTE: this function is not a binding of the original luaL_dostring, it's rather an OCaml function with the same semantics.

val error : Lua_api_lib.state -> ('a, unit, string, 'b) Stdlib.format4 -> 'a

See luaL_error documentation.

NOTE: this function is not a binding of the original luaL_error, it's rather an OCaml function with the same semantics.

Warning: this function has a different behavior with respect to the original luaL_error because the conversion specifiers are not restricted as specified in the Lua documentation, but you can use all the conversions of the Printf module.

val getmetafield : Lua_api_lib.state -> int -> string -> bool

See luaL_getmetafield documentation.

val getmetatable : Lua_api_lib.state -> string -> unit

See luaL_getmetatable documentation.

val gsub : Lua_api_lib.state -> string -> string -> string -> string

See luaL_gsub documentation.

val loadbuffer : Lua_api_lib.state -> string -> string -> Lua_api_lib.thread_status

See luaL_loadbuffer documentation.

val loadfile : Lua_api_lib.state -> string -> Lua_api_lib.thread_status

See luaL_loadfile documentation.

val loadstring : Lua_api_lib.state -> string -> Lua_api_lib.thread_status

See luaL_loadstring documentation.

val newmetatable : Lua_api_lib.state -> string -> bool

See luaL_newmetatable documentation.

val newstate : ?max_memory_size:int -> unit -> Lua_api_lib.state

See luaL_newstate documentation.

NOTE: this function is not a binding of the original luaL_newstate, it's rather an OCaml function with the same semantics.

An optional parameter, not available in the original luaL_newstate, provide the user the chance to specify the maximum memory (in byte) that Lua is allowed to allocate for this state.

val openlibs : Lua_api_lib.state -> unit

See luaL_openlibs documentation.

val optint : Lua_api_lib.state -> int -> int -> int

See luaL_optint documentation.

NOTE: this function is an alias of Lua_aux_lib.optinteger

val optinteger : Lua_api_lib.state -> int -> int -> int

See luaL_optinteger documentation.

val optlong : Lua_api_lib.state -> int -> int -> int

See luaL_optlong documentation.

val optlstring : Lua_api_lib.state -> int -> string -> string

See luaL_optlstring documentation.

NOTE: this function is not a binding of the original luaL_optlstring, it's rather an OCaml function with the same semantics.

val optnumber : Lua_api_lib.state -> int -> float -> float

See luaL_optnumber documentation.

NOTE: this function is not a binding of the original luaL_optnumber, it's rather an OCaml function with the same semantics.

val optstring : Lua_api_lib.state -> int -> string -> string

See luaL_optstring documentation.

NOTE: this function is an alias of Lua_aux_lib.optlstring

The function luaL_prepbuffer is not present because the type Lua_aux_lib.buffer and related functions have been reimplemented in OCaml, and luaL_prepbuffer is not needed.

val pushresult : buffer -> unit

See luaL_pushresult documentation.

NOTE: this function is not a binding of the original luaL_pushresult, it's rather an OCaml function with the same semantics.

val ref_ : Lua_api_lib.state -> int -> int

See luaL_ref documentation.

val register : Lua_api_lib.state -> string option -> reg list -> unit

See luaL_register documentation.

NOTE: this function is not a binding of the original luaL_register, it's rather an OCaml function with the same semantics.

val typename : Lua_api_lib.state -> int -> string

See luaL_typename documentation.

NOTE: this function is not a binding of the original luaL_typename, it's rather an OCaml function with the same semantics.

val typerror : Lua_api_lib.state -> int -> string -> 'a

See luaL_typerror documentation.

val unref : Lua_api_lib.state -> int -> int -> unit

See luaL_unref documentation.

val where : Lua_api_lib.state -> int -> unit

See luaL_where documentation.