| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
debug.getinfo on bytecode module/func don't give you detail source info.
Solution:
- Use `loadstring`+`string.dump` to replace LUAC_PRG(`luac`/`luajit -b`)
- `string.dump(…,false)` to generate non-strip version bytecode
- `loadstring(…,fname)` to specify the full source name
BEFORE:
$ nvim --clean +'=debug.getinfo(vim.fn.maparg("]<Space>", "n", 0, 1).callback, "Sl")' --headless +q
{
currentline = -1,
lastlinedefined = 456,
linedefined = 452,
short_src = "?",
source = "=?",
what = "Lua"
}
AFTER:
$ nvim --clean +'=debug.getinfo(vim.fn.maparg("]<Space>", "n", 0, 1).callback, "Sl")' --headless +q
{
currentline = -1,
lastlinedefined = 456,
linedefined = 452,
short_src = "/home/xx/b/neovim/runtime/lua/vim/_core/defaults.lua",
source = "@/home/xx/b/neovim/runtime/lua/vim/_core/defaults.lua",
what = "Lua"
}
|