This commit is contained in:
FlightControl_Master 2017-11-10 11:12:48 +01:00
parent 1848e117aa
commit f3bd097e6f
3 changed files with 48 additions and 5 deletions

View File

@ -0,0 +1,37 @@
--Initialization script for the Mission lua Environment (SSE)
dofile('Scripts/ScriptingSystem.lua')
-- 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", "" )
--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

View File

@ -78,10 +78,16 @@ Thats it on the LDT side.
This process is essential.
Within the MOOSE repository, there are two files that you need to consider.
These files are located
Within the MOOSE repository, there are two important files that you need to consider.
These files are located in the MOOSE repository [here](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Development/Debugger).
Download the MOOSE repository or the files on your disk, and read further ...
You should have at least on your disk:
* debugger.lua
* READ.ME
* MissionScripting.lua
### 3.1. debugger.lua.
@ -90,11 +96,11 @@ You need to copy this file to the root directory of your DCS World installation
![](Debugging/DEBUG_debugger.JPG)
The location of debugger.lua is here on my DCS World installation.
By example, the location of debugger.lua is here on my DCS World installation PC.
### 3.2. Modify the MissionScripting.lua file.
The connect.lua file is a file that contains an explanation of how to modify the MissionScripting.lua.
The READ.ME file is a file that contains an explanation of how to modify the MissionScripting.lua.
But for clarity reasons, I've also attached my version of the MissionScripting.lua.
@ -158,7 +164,7 @@ The io module has been de-sanitized because the debugger.lua needs to use the io
When you run a mission in single player in DCS World, a couple of things are happening.
1. The .miz (mission) file that was selected to run, is unzipped in a temp folder on your drive.
2. Each lua file that is included in a DO SCRIPT FILE, is **RENAMED** to a file structure like ~mis__nnnnn___.lua.
2. Each lua file that is included in a DO SCRIPT FILE, is **RENAMED** to a file structure like ~mis__nnnnn__.lua.
This is very bad. Because this prevents you from settings breakpoints at the source file and ensure that the debugger
recognizes the source during run and the location of the breakpoint!