Function lua_objlen

Source
pub unsafe extern "C-unwind" fn lua_objlen(
    L: *mut lua_State,
    idx: c_int,
) -> c_int
Expand description

Returns the length of the value at the given index.

Length is defined differently for different types:

  • For strings, it returns the length of the string in bytes.
  • For userdata, it returns the size of the userdata in bytes.
  • For buffers, it returns the length of the buffer in bytes.
  • For tables, it returns the same value that the length operator (#) would return.

If the value is not one of these types, this function will return 0.