Home Explore Blog CI



neovim

30th chunk of `runtime/doc/luaref.txt`
7b2a0f781890e96117cd439e59580eefdec4c578f4b1470b0000000100000fa3
 type used by the Lua API to represent integral values.

        By default it is a `ptrdiff_t`, which is usually the largest integral
        type the machine handles "comfortably".

lua_isboolean                                                  *lua_isboolean()*
>c
    int lua_isboolean (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index has type boolean,
        and 0 otherwise.

lua_iscfunction                                              *lua_iscfunction()*
>c
    int lua_iscfunction (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a C function,
        and 0 otherwise.

lua_isfunction                                                *lua_isfunction()*
>c
    int lua_isfunction (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a function
        (either C or Lua), and 0 otherwise.

lua_islightuserdata                                      *lua_islightuserdata()*
>c
    int lua_islightuserdata (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a light
        userdata, and 0 otherwise.

lua_isnil                                                          *lua_isnil()*
>c
    int lua_isnil (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is `nil`, and 0
        otherwise.

lua_isnumber                                                    *lua_isnumber()*
>c
    int lua_isnumber (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a number or a
        string convertible to a number, and 0 otherwise.

lua_isstring                                                    *lua_isstring()*
>c
    int lua_isstring (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a string or a
        number (which is always convertible to a string), and 0 otherwise.

lua_istable                                                      *lua_istable()*
>c
    int lua_istable (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a table, and
        0 otherwise.

lua_isthread                                                    *lua_isthread()*
>c
    int lua_isthread (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a thread, and
        0 otherwise.

lua_isuserdata                                                *lua_isuserdata()*
>c
    int lua_isuserdata (lua_State *L, int index);
<
        Returns 1 if the value at the given acceptable index is a userdata
        (either full or light), and 0 otherwise.

lua_lessthan                                                    *lua_lessthan()*
>c
    int lua_lessthan (lua_State *L, int index1, int index2);
<
        Returns 1 if the value at acceptable index `index1` is smaller than
        the value at acceptable index `index2`, following the semantics of the
        Lua `<` operator (that is, may call metamethods). Otherwise returns 0.
        Also returns 0 if any of the indices is non valid.

lua_load                                                            *lua_load()*
>c
    int lua_load (lua_State *L,
                  lua_Reader reader,
                  void *data,
                  const char *chunkname);
<
        Loads a Lua chunk. If there are no errors, `lua_load` pushes the
        compiled chunk as a Lua function on top of the stack. Otherwise, it
        pushes an error message. The return values of `lua_load` are:

         - `0`: no errors;
         - `LUA_ERRSYNTAX` : syntax error during pre-compilation;
         - `LUA_ERRMEM` : memory allocation error.

        This function only loads a chunk; it does not run it.

        `lua_load` automatically detects whether the chunk is text or binary,
        and loads it accordingly (see program `luac`).

        The `lua_load` function uses a user-supplied `reader` function to read
        the

Title: Lua C API: Type Checking and Chunk Loading
Summary
This section details Lua C API functions for type checking and chunk loading. It covers `lua_isboolean`, `lua_iscfunction`, `lua_isfunction`, `lua_islightuserdata`, `lua_isnil`, `lua_isnumber`, `lua_isstring`, `lua_istable`, `lua_isthread`, and `lua_isuserdata`, all of which check the type of a value at a given index on the Lua stack. `lua_lessthan` compares two values using Lua's `<` operator. `lua_load` loads a Lua chunk, pushing the compiled chunk as a function onto the stack or an error message if loading fails.