Home Explore Blog CI



neovim

35th chunk of `runtime/doc/luaref.txt`
864e504a61b968c1b935312f740c063023cd31f33e1417ab0000000100000fa0
 *lua_pushstring()*
>c
    void lua_pushstring (lua_State *L, const char *s);
<
        Pushes the zero-terminated string pointed to by `s` onto the stack.
        Lua makes (or reuses) an internal copy of the given string, so the
        memory at `s` can be freed or reused immediately after the function
        returns. The string cannot contain embedded zeros; it is assumed to
        end at the first zero.

lua_pushthread                                                *lua_pushthread()*
>c
    int lua_pushthread (lua_State *L);
<
        Pushes the thread represented by `L` onto the stack. Returns 1 if this
        thread is the main thread of its state.

lua_pushvalue                                                  *lua_pushvalue()*
>c
    void lua_pushvalue (lua_State *L, int index);
<
        Pushes a copy of the element at the given valid index onto the stack.

lua_pushvfstring                                            *lua_pushvfstring()*
>c
    const char *lua_pushvfstring (lua_State *L,
                                  const char *fmt,
                                  va_list argp);
<
        Equivalent to `lua_pushfstring` (see |lua_pushfstring()|), except
        that it receives a `va_list` instead of a variable number of
        arguments.

lua_rawequal                                                    *lua_rawequal()*
>c
    int lua_rawequal (lua_State *L, int index1, int index2);
<
        Returns 1 if the two values in acceptable indices `index1` and
        `index2` are primitively equal (that is, without calling metamethods).
        Otherwise returns 0. Also returns 0 if any of the indices are non
        valid.

lua_rawget                                                        *lua_rawget()*
>c
    void lua_rawget (lua_State *L, int index);
<
        Similar to `lua_gettable` (see |lua_gettable()|), but does a raw
        access (i.e., without metamethods).

lua_rawgeti                                                      *lua_rawgeti()*
>c
    void lua_rawgeti (lua_State *L, int index, int n);
<
        Pushes onto the stack the value `t[n]`, where `t` is the value at the
        given valid index `index`. The access is raw; that is, it does not
        invoke metamethods.

lua_rawset                                                        *lua_rawset()*
>c
    void lua_rawset (lua_State *L, int index);
<
        Similar to `lua_settable` (see |lua_settable()|), but does a raw
        assignment (i.e., without metamethods).

lua_rawseti                                                      *lua_rawseti()*
>c
    void lua_rawseti (lua_State *L, int index, int n);
<
        Does the equivalent of `t[n] = v`, where `t` is the value at the given
        valid index `index` and `v` is the value at the top of the stack.

        This function pops the value from the stack. The assignment is raw;
        that is, it does not invoke metamethods.

lua_Reader                                                          *lua_Reader*
>c
    typedef const char * (*lua_Reader) (lua_State *L,
                                        void *data,
                                        size_t *size);
<
        The reader function used by `lua_load` (see |lua_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`. The reader function may return pieces of any size greater than
        zero.

lua_register                                                    *lua_register()*
>c
    void lua_register (lua_State *L,
                       const char *name,
                       lua_CFunction f);
<
        Sets the C function `f` as the new value of global `name`. It is
       

Title: Lua C API: Stack Manipulation and Raw Table Access
Summary
This section details more functions in the Lua C API. It covers `lua_pushvfstring`, which is like `lua_pushfstring` but uses a `va_list`. It also covers `lua_rawequal` for primitive equality checks without metamethods, `lua_rawget` and `lua_rawgeti` for raw table access (without metamethods), and `lua_rawset` and `lua_rawseti` for raw table assignment. Also the definition of `lua_Reader` function type used by `lua_load` and `lua_register` for registering a C function as a global variable in Lua.