Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

Module lua/utils

Push cdata of given ctypeid onto the stack.

CTypeID must be used from FFI at least once. Allocated memory returned uninitialized. Only numbers and pointers are supported.

Parameters:

  • L (lua_State*) — Lua State

  • ctypeid (uint32_t) — FFI's CTypeID of this cdata

Returns

memory associated with this cdata

See also: luaL_checkcdata()

Check whether the function argument idx is a cdata.

  • L (lua_State*) — Lua State

  • idx (int) — stack index

  • ctypeid (uint32_t*) — output argument. FFI's CTypeID of returned cdata

Returns

memory associated with this cdata

See also: luaL_pushcdata()

Set finalizer function on a cdata object.

Equivalent to call ffi.gc(obj, function). Finalizer function must be on the top of the stack.

  • L (lua_State*) — Lua State

  • idx (int) — stack index

Return CTypeID (FFI) of given СDATA type.

  • L (lua_State*) — Lua State

  • ctypename (const char*) — C type name as string (e.g. "struct request" or "uint32_t")

Returns

CTypeID

See also: luaL_pushcdata(), luaL_checkcdata()

Declare symbols for FFI.

  • L (lua_State*) — Lua State

  • ctypename (const char*) — C definitions (e.g. "struct stat")

Returns

0 on success

Returns

LUA_ERRRUN, LUA_ERRMEM or LUA_ERRERR otherwise.

See also: ffi.cdef(def)

Push uint64_t onto the stack.

  • L (lua_State*) — Lua State

  • val (uint64_t) — value to push

Push int64_t onto the stack.

  • L (lua_State*) — Lua State

  • val (int64_t) — value to push

Check whether the argument idx is a uint64 or a convertible string and returns this number.

throws : error if the argument can't be converted

Check whether the argument idx is a int64 or a convertible string and returns this number.

throws : error if the argument can't be converted

Check whether the argument idx is a uint64 or a convertible string and returns this number.

Returns

the converted number or 0 of argument can't be converted

Check whether the argument idx is a int64 or a convertible string and returns this number.

Returns

the converted number or 0 of argument can't be converted

Push a tuple onto the stack.

  • L (lua_State*) — Lua State

throws : error on OOM

See also: luaT_istuple

Check whether idx is a tuple.

  • L (lua_State*) — Lua State

  • idx (int) — the stack index

Returns

non-NULL if idx is a tuple

Returns

NULL if idx is not a tuple

Re-throw the last Tarantool error as a Lua object.

See also: lua_error(),

: box_error_last().

Similar to lua_cpcall(), but with the proper support of Tarantool errors.

Get the global Lua state used by Tarantool.