actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
429 stars 92 forks source link

[Question] What Lua functions are required for the plugin to operate? #278

Open LostTime76 opened 8 months ago

LostTime76 commented 8 months ago

Hello:

I am in the process of making a custom Lua build to use as my scripting engine in a host program. I am removing or replacing much of the Lua standard library with my own versions that support Utf8 directly. I would like debugging support through this plugin as it seems like this project is the most active.

I have not browsed the code of this plugin extensively, but it seems like it is replacing or doing a lot of its own operations and not using the Lua standard library so much, like the debug library.

Here is a list of the standard library that I would like to remove or replace:

  1. Base library -> assert, dofile, error, load, loadfile, print, warn: replaced with Utf8 compatible versions
  2. Modules library -> Remove everything except what is needed. New package loader / requires that supports Utf8 paths
  3. String library -> Remove everything replace as needed
  4. Utf8 library -> Remove everything replace as needed
  5. Math library -> Remove everything replace as needed
  6. Io library -> Remove everything replace as needed
  7. Os library -> Remove everything replace as needed
  8. Debug library -> Remove everything unless needed

My question is, what standard library functions need to be present within the custom Lua build for this plugin to operate correctly?

Thanks

actboy168 commented 8 months ago

The design of lua-debug minimizes the requirements for debugging targets. But in practice no one has done this.

There are two places in the Lua code that depend on the debugging target: 1.script/debugger.lua. Load the debugger code, which allows loading in any arch, any os, and any lua version. For customized debugging goals, it can be simplified a lot, and you can implement it yourself. 2.script/backend/worker/eval/*.lua. Execute code in the debug target. I haven't encountered the need to modify it.

But anyway this is a Lua debugger, it can only be used to debug Lua. If the difference between the debugging target and Lua is too big to even be called Lua, then luadebug can't do anything.