mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'LDT-Debug'
This commit is contained in:
56
Moose Development/Debugger/connect.lua
Normal file
56
Moose Development/Debugger/connect.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
-- If you want to use the debugger, move these 3 lines into MissionScripting.lua of DCS world.
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
-- MissionScripting.lua modifications
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- --Initialization script for the Mission lua Environment (SSE)
|
||||
--
|
||||
-- dofile('Scripts/ScriptingSystem.lua')
|
||||
--
|
||||
-- package.path = package.path..";.\\LuaSocket\\?.lua;"
|
||||
-- local initconnection = require("debugger")
|
||||
-- initconnection( "127.0.0.1", 10000, "dcsserver", nil, "win", "" )
|
||||
--
|
||||
-- --Sanitize Mission Scripting environment
|
||||
-- --This makes unavailable some unsecure functions.
|
||||
-- --Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
|
||||
-- --You can remove the code below and make availble these functions at your own risk.
|
||||
--
|
||||
-- local function sanitizeModule(name)
|
||||
-- _G[name] = nil
|
||||
-- package.loaded[name] = nil
|
||||
-- end
|
||||
--
|
||||
-- do
|
||||
-- sanitizeModule('os')
|
||||
-- --sanitizeModule('io')
|
||||
-- sanitizeModule('lfs')
|
||||
-- require = nil
|
||||
-- loadlib = nil
|
||||
-- end
|
||||
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
-- So for clarity, these are the three lines of code that matter!
|
||||
|
||||
-- Add LuaSocket to the LUAPATH, so that it can be found.
|
||||
package.path = package.path..";.\\LuaSocket\\?.lua;"
|
||||
|
||||
-- Connect to the debugger, first require it.
|
||||
local initconnection = require("debugger")
|
||||
|
||||
-- Now make the connection..
|
||||
-- "127.0.0.1" is the localhost.
|
||||
-- 10000 is the port. If you wanna use another port in LDT, change this number too!
|
||||
-- "dcsserver" is the name of the server. If you wanna use another name, change the name here too!
|
||||
-- nil (is for transport protocol, but not using this)
|
||||
-- "win" don't touch. But is important to indicate that we are in a windows environment to the debugger script.
|
||||
initconnection( "127.0.0.1", 10000, "dcsserver", nil, "win", "" )
|
||||
|
||||
3374
Moose Development/Debugger/debugger.lua
Normal file
3374
Moose Development/Debugger/debugger.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -111,7 +111,11 @@ routines.utils.oneLineSerialize = function(tbl) -- serialization of a table all
|
||||
tbl_str[#tbl_str + 1] = '}'
|
||||
return table.concat(tbl_str)
|
||||
else
|
||||
if type(tbl) == 'string' then
|
||||
return tbl
|
||||
else
|
||||
return tostring(tbl)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,7 +131,7 @@ routines.utils.basicSerialize = function(s)
|
||||
if ((type(s) == 'number') or (type(s) == 'boolean') or (type(s) == 'function') or (type(s) == 'table') or (type(s) == 'userdata') ) then
|
||||
return tostring(s)
|
||||
elseif type(s) == 'string' then
|
||||
s = string.format('%q', s)
|
||||
s = string.format('%s', s:gsub( "%%", "%%%%" ) )
|
||||
return s
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user