Home Explore Blog CI



neovim

73th chunk of `runtime/doc/luaref.txt`
556f18bd39865460960d000183877555b72447471bf35e680000000100000fa0
 `time` can be used only as an argument to `date` and `difftime`.

os.tmpname()                                                      *os.tmpname()*
        Returns a string with a file name that can be used for a temporary
        file. The file must be explicitly opened before its use and explicitly
        removed when no longer needed.

==============================================================================
5.9  The Debug Library                                         *lua-lib-debug*

This library provides the functionality of the debug interface to Lua
programs. You should exert care when using this library. The functions
provided here should be used exclusively for debugging and similar tasks, such
as profiling. Please resist the temptation to use them as a usual programming
tool: they can be very slow. Moreover, several of its functions violate some
assumptions about Lua code (e.g., that variables local to a function cannot be
accessed from outside or that userdata metatables cannot be changed by Lua
code) and therefore can compromise otherwise secure code.

All functions in this library are provided inside the `debug` table. All
functions that operate over a thread have an optional first argument which is
the thread to operate over. The default is always the current thread.

debug.debug()                                                    *debug.debug()*
        Enters an interactive mode with the user, running each string that the
        user enters. Using simple commands and other debug facilities, the
        user can inspect global and local variables, change their values,
        evaluate expressions, and so on. A line containing only the word
        `cont` finishes this function, so that the caller continues its
        execution.

        Note that commands for `debug.debug` are not lexically nested within
        any function, and so have no direct access to local variables.

debug.getfenv(o)                                               *debug.getfenv()*
        Returns the environment of object {o}.

debug.gethook([{thread}])                                      *debug.gethook()*
        Returns the current hook settings of the thread, as three values: the
        current hook function, the current hook mask, and the current hook
        count (as set by the `debug.sethook` function).

debug.getinfo([{thread},] {function} [, {what}])               *debug.getinfo()*
        Returns a table with information about a function. You can give the
        function directly, or you can give a number as the value of
        {function}, which means the function running at level {function} of
        the call stack of the given thread: level 0 is the current function
        (`getinfo` itself); level 1 is the function that called `getinfo`; and
        so on. If {function} is a number larger than the number of active
        functions, then `getinfo` returns `nil`.

        The returned table may contain all the fields returned by
        `lua_getinfo` (see |lua_getinfo()|), with the string {what}
        describing which fields to fill in. The default for {what} is to get
        all information available, except the table of valid lines. If
        present, the option `f` adds a field named `func` with the function
        itself. If present, the option `L` adds a field named `activelines`
        with the table of valid lines.

        For instance, the expression `debug.getinfo(1,"n").name` returns the
        name of the current function, if a reasonable name can be found, and
        `debug.getinfo(print)` returns a table with all available information
        about the `print` function.

debug.getlocal([{thread},] {level}, {local})                  *debug.getlocal()*
        This function returns the name and the value of the local variable
        with index {local} of the function at level {level} of the stack. (The
        first parameter or local variable has index 1, and so on, until the
        last

Title: Lua Debug Library: Functions for Debugging, Inspection, and Introspection
Summary
This section describes the Lua `debug` library, which offers debugging functionalities. It includes `debug.debug()` for interactive debugging, `debug.getfenv()` to retrieve an object's environment, `debug.gethook()` to get the current hook settings, `debug.getinfo()` to get information about a function or stack level, and `debug.getlocal()` to get the name and value of a local variable at a specific stack level.