Debug.lua

Error running Lua task: [71D78F4310179502] Utils:124: attempt to index a nil value (global 'debug')

look above, logcat output the error when I call :
local traceback = string.split(debug.traceback("", 2), "\n")

check the lua lib:


find debug.lua, I don't known what's wrong

There is no access to the lua internal debug.lua functions directly. I assume this is to do with how the scripts are used in Core, but that's just speculation on my part.

However, there is hope! In the editor, main menu, Window - Script - Script Debugger. Grab the tab and drop it somewhere useful (I usually put it next to the event log).

Check the first two debug buttons (pause on breakpoint and pause on error). So this is a start.

Next right lick on your script in the hierarchy and Edit Script (not Edit Script in External Editor). This opens a very basic looking text editor with your script in it - the only redeeming feature of this is that you can make single left clicks to the left of the line numbers to toggle breakpoints which work with the Script Debugger.

This is expected core only provide a subset of the lua implementation
Lua functions
The Sumneko extension refer to the whole lua api. So intellisense show definitions of functions not available in the lua version of core.
You can't access debug, io, most of os. Those libraries(tables) have been removed, some are partially removed e.g string.dump() or loadstring().

You can remove missing builtin lib with settings.json file e.g

{
    "Lua.diagnostics.globals": [
    ],
    "files.exclude": {
        "**/Scripts/*.pbt": true
    },
    "Lua.runtime.builtin": {
        "io": "disable",
        "debug": "disable"
    }
}

Don't forget to reload your window

This is only a partial fix because on some lib only some functions are missing.
Maybe a better fix involve disabling many libs and reintroduce the class and the definition in:

As @RedQuad said the only chance to debug is via the editor debugger.
But if you use debug to have some sort of reflection you have no luck :confused: