-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZBS and DCS World #992
Comments
I can't say for sure, but you'd need to be able to load luasocket and mobdebug.lua into that environment if you want to be able to support remote debugging there. It's possible to get it to work in many cases, but there are some for sure that either disable some of debug.* methods or don't allow loading of binary modules. The documentation for remote debugging is available here. |
I've tried but I do get an error.
and get this error
Did you get this to work? |
It looks like you may not have You can try the following patch to see if that helps: diff --git a/lualibs/mobdebug/mobdebug.lua b/lualibs/mobdebug/mobdebug.lua
index 36fa14c3..69c0f238 100644
--- a/lualibs/mobdebug/mobdebug.lua
+++ b/lualibs/mobdebug/mobdebug.lua
@@ -369,6 +369,7 @@ end
local function restore_vars(vars)
if type(vars) ~= 'table' then return end
+ if not debug.getlocal or not debug.getupvalue then return end
-- locals need to be processed in the reverse order, starting from
-- the inner block out, to make sure that the localized variables
@@ -413,7 +414,7 @@ end
local function capture_vars(level, thread)
level = (level or 0)+2 -- add two levels for this and debug calls
local func = (thread and debug.getinfo(thread, level, "f") or debug.getinfo(level, "f") or {}).func
- if not func then return {} end
+ if not func or not debug.getlocal or not debug.getupvalue then return {} end
local vars = {['...'] = {}}
local i = 1 |
That does get me further along (ie DCS starts up and I can step thru code), is there anyway I can force that to work? |
I think that's the best that can be done without those functions ( Can you print the list of functions available in |
you have to excuse me I"m learning lua as I go here. |
Yes, you'd need to so something like |
I had to write this to a log file using the supplied log util in DCS
Produced this
|
It looks like you may only be missing getupvalue, so getlocal should still work. Try this modified patch: diff --git a/lualibs/mobdebug/mobdebug.lua b/lualibs/mobdebug/mobdebug.lua
index 36fa14c3..69c0f238 100644
--- a/lualibs/mobdebug/mobdebug.lua
+++ b/lualibs/mobdebug/mobdebug.lua
@@ -369,6 +369,7 @@ end
local function restore_vars(vars)
if type(vars) ~= 'table' then return end
+ if not debug.getupvalue then return end
-- locals need to be processed in the reverse order, starting from
-- the inner block out, to make sure that the localized variables
@@ -413,7 +414,7 @@ end
local function capture_vars(level, thread)
level = (level or 0)+2 -- add two levels for this and debug calls
local func = (thread and debug.getinfo(thread, level, "f") or debug.getinfo(level, "f") or {}).func
- if not func then return {} end
+ if not func or not debug.getupvalue then return {} end
local vars = {['...'] = {}}
local i = 1 |
Actually, scratch that, as it's not going to help. I'll provide a new patch shortly. |
Try this patch: diff --git a/lualibs/mobdebug/mobdebug.lua b/lualibs/mobdebug/mobdebug.lua
index 36fa14c3..7f27bdd6 100644
--- a/lualibs/mobdebug/mobdebug.lua
+++ b/lualibs/mobdebug/mobdebug.lua
@@ -317,7 +317,7 @@ local function stack(start)
-- get upvalues
i = 1
local ups = {}
- while func do -- check for func as it may be nil for tail calls
+ while func and debug.getupvalue do -- check for func as it may be nil for tail calls
local name, value = debug.getupvalue(func, i)
if not name then break end
ups[name] = {value, select(2,pcall(tostring,value))}
@@ -397,7 +397,7 @@ local function restore_vars(vars)
i = 1
local func = debug.getinfo(3, "f").func
- while true do
+ while debug.getupvalue do
local name = debug.getupvalue(func, i)
if not name then break end
if not written_vars[name] then
@@ -417,7 +417,7 @@ local function capture_vars(level, thread)
local vars = {['...'] = {}}
local i = 1
- while true do
+ while debug.getupvalue do
local name, value = debug.getupvalue(func, i)
if not name then break end
if string.sub(name, 1, 1) ~= '(' then vars[name] = value end |
No Dice, |
Are you sure you're using the latest patch? You should be able to get the watches to work with it (assuming you do have debug.getlocal available). Can you also check if the Stack window (Ctrl-Shift-S) is showing any values for local variables? Can you also try printing local values from the Console (when the app is running and is stopped in the debugger)? What do you get if you stop on line 4 in this script and try to print the value of baz in the Local console or check the stack?
|
I redid the patch and its working |
ok, just to confirm, you got the watches and local console values working with the latest patch? |
That is correct |
@kbastronomics, should be fixed now. |
Hello Paul,
do you know if it's possible to connect ZBS to DCS world LUA environment for scripting and debuging in?
If it's possible, can you tell us how we can do it ?
I use actuallly Witchcraft witch permit to send from the Witchcraft console (snippets) a code to a node.js server on a port. And this node.js server relay it to DCA World by another port. But, this solution doesn't permit to debbug line by line, and the ergonomics of this solution is not comparable to ZBS.
I have tried to connect ZBS to Witchcraft node.js (it seems ok), but when I send a correct simple LUA code, I have an error message.
Thank's
The text was updated successfully, but these errors were encountered: