Home Explore Blog CI



neovim

75th chunk of `runtime/doc/luaref.txt`
88dbdd3c07889e820aaef80a3c8c1ede428c0084533263de0000000100000a1a
 a string describing
        the event that triggered its call: `"call"`, `"return"` (or
        `"tail return"`), `"line"`, and `"count"`. For line events, the hook also
        gets the new line number as its second parameter. Inside a hook, you
        can call `getinfo` with level 2 to get more information about the
        running function (level 0 is the `getinfo` function, and level 1 is
        the hook function), unless the event is `"tail return"`. In this case,
        Lua is only simulating the return, and a call to `getinfo` will return
        invalid data.

debug.setlocal([{thread},] {level}, {local}, {value})         *debug.setlocal()*
        This function assigns the value {value} to the local variable with
        index {local} of the function at level {level} of the stack. The
        function returns `nil` if there is no local variable with the given
        index, and raises an error when called with a {level} out of range.
        (You can call `getinfo` to check whether the level is valid.)
        Otherwise, it returns the name of the local variable.

debug.setmetatable({object}, {table})                     *debug.setmetatable()*
        Sets the metatable for the given {object} to the given {table} (which
        can be `nil`).

debug.setupvalue({func}, {up}, {value})                     *debug.setupvalue()*
        This function assigns the value {value} to the upvalue with index {up}
        of the function {func}. The function returns `nil` if there is no
        upvalue with the given index. Otherwise, it returns the name of the
        upvalue.

debug.traceback([{thread},] [{message} [,{level}]])          *debug.traceback()*
        Returns a string with a traceback of the call stack. An optional
        {message} string is appended at the beginning of the traceback. An
        optional {level} number tells at which level to start the traceback
        (default is 1, the function calling `traceback`).

==============================================================================
A  BIBLIOGRAPHY                                            *lua-ref-bibliography*

This help file is a minor adaptation from this main reference:

 - R. Ierusalimschy, L. H. de Figueiredo, and W. Celes.,
   "Lua: 5.1 reference manual", https://www.lua.org/manual/5.1/manual.html

Lua is discussed in these references:

 - R. Ierusalimschy, L. H. de Figueiredo, and W. Celes.,
   "Lua --- an extensible extension language".
   "Software: Practice & Experience" 26, 6 (1996) 635-652.

 - L. H. de Figueiredo, R. Ierusalimschy, and W. Celes.,

Title: Lua Debug Library: Setting Local Variables, Metatables, Upvalues, and Tracebacks; Bibliography
Summary
This section details the Lua debug library functions `debug.setlocal()` for assigning values to local variables, `debug.setmetatable()` for setting metatables, `debug.setupvalue()` for assigning values to upvalues, and `debug.traceback()` for generating a call stack traceback. The section concludes with a bibliography referencing the Lua 5.1 reference manual and other related publications.